📄 reportctl.h
字号:
#if !defined(AFX_REPORTCTL_H__4918FDEF_1023_4E79_BB2C_169E5D003E10__INCLUDED_)
#define AFX_REPORTCTL_H__4918FDEF_1023_4E79_BB2C_169E5D003E10__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ReportCtl.h : Declaration of the CReportCtrl ActiveX Control class.
/////////////////////////////////////////////////////////////////////////////
// CReportCtrl : See ReportCtl.cpp for implementation.
#include "excel9.h"
#include "msword9.h"
#include<comdef.h>
class CReportCtrl : public COleControl
{
DECLARE_DYNCREATE(CReportCtrl)
enum ReportType {OneRecordOneReport=1,OneGroupRecordOneReport,
OneTableOneReport};
static const short ReportTypeNum;
enum ReportCharacter {EveryReportPageAlone=0x00000001,
VerticalAjacentCellUnite=0x00000002,Group=0x00000004};
static const short ReportCharacterNum;
static const CString m_Errorinformation[];
// Constructor
public:
CReportCtrl();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReportCtrl)
public:
virtual void OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid);
virtual void DoPropExchange(CPropExchange* pPX);
virtual void OnResetState();
//}}AFX_VIRTUAL
// Implementation
protected:
~CReportCtrl();
DECLARE_OLECREATE_EX(CReportCtrl) // Class factory and guid
DECLARE_OLETYPELIB(CReportCtrl) // GetTypeInfo
DECLARE_PROPPAGEIDS(CReportCtrl) // Property page IDs
DECLARE_OLECTLTYPE(CReportCtrl) // Type name and misc status
// Message maps
//{{AFX_MSG(CReportCtrl)
// NOTE - ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Dispatch maps
//{{AFX_DISPATCH(CReportCtrl)
CString m_reportTemplateFileName;
afx_msg void OnReportTemplateFileNameChanged();
CString m_reportFileName;
afx_msg void OnReportFileNameChanged();
CString m_groupProperty;
afx_msg void OnGroupPropertyChanged();
CString m_filePath;
afx_msg void OnFilePathChanged();
CString m_dataSourceKey;
afx_msg void OnDataSourceKeyChanged();
afx_msg BSTR GetDateSourceName();
afx_msg void SetDateSourceName(LPCTSTR lpszNewValue);
afx_msg short GetReportType();
afx_msg void SetReportType(short nNewValue);
afx_msg short GetReportCharacter();
afx_msg void SetReportCharacter(short nNewValue);
afx_msg BSTR GetErrorInformation();
afx_msg short MakeReport();
afx_msg void QuitExcel();
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
afx_msg void AboutBox();
// Event maps
//{{AFX_EVENT(CReportCtrl)
//}}AFX_EVENT
DECLARE_EVENT_MAP()
// Dispatch and event IDs
public:
enum {
//{{AFX_DISP_ID(CReportCtrl)
dispidReportTemplateFileName = 1L,
dispidDateSourceName = 6L,
dispidReportType = 7L,
dispidReportFileName = 2L,
dispidReportCharacter = 8L,
dispidGroupProperty = 3L,
dispidFilePath = 4L,
dispidDataSourceKey = 5L,
dispidGetErrorInformation = 9L,
dispidMakeReport = 10L,
dispidQuitExcel = 11L,
//}}AFX_DISP_ID
};
private:
void EndWord();
int * pGroupDataSourcePropertySN;
int * pDataSourcePropertyKeySN;
void EndExcel();
int FindBookmarkName(CStringArray &x,CString &str);
bool GetExcelRowToArray(int n,CStringArray & prostrarr,int SpaceEndOrAppointCol=0);
short BookmarkType(CString &BookmarklName);
short OneRecordOneReportMakeReport();
short DeleteSpace(CString &str,int flag);
bool IsSpecificallyFile(CString filename,CString extendname);
bool DataSourceKeyIsExist();
CStringArray DataSourceProperty,GroupDataSourceProperty,
DataSourcePropertyKey;
bool IsOneStrBelongAnotherStr(CStringArray &one,CStringArray &anotherstr,int *p=NULL);
int GetDataSourceProperty(CStringArray &prostrarr);
int ExtractSubtring(CString &str,CStringArray &strarr);
int ReMoveChar(CString &str,char ch);
bool IsGroupPropertyExist();
bool grouping();
bool IsLegalFileName(CString name,bool wildcard=false);
bool IsDirExist(CString name,CString parentdirname="");
bool IsFileExist(CString name,CString dirname="");
CString m_DateSourceName;
ReportType m_ReportType;
short m_ReportCharacter;
short m_ErrorinformationCode;
_Application excel;
Workbooks books;
_Workbook book;
Sheets sheets;
_Worksheet worksheet;
//
_Applicationword word;
Documents worddocs;
_Document worddoc_TemplateFile,worddoc_ReportFile;
Bookmarks bookmarks;
Window window;
Selection select;
Bookmark bookmark;
View view;
Paragraphs paragraphs;
Paragraph paragraph;
Characters characters;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_REPORTCTL_H__4918FDEF_1023_4E79_BB2C_169E5D003E10__INCLUDED)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -