1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
class CMSWord
{
protected:
IDispatch* m_pWApp;
IDispatch* m_pDocuments;
IDispatch* m_pActiveDocument;
HRESULT m_hr;
public:
CMSWord();
~CMSWord();
HRESULT Initialize(bool bVisible=true);
HRESULT SetVisible(bool bVisible=true);
HRESULT Quit();
HRESULT OpenDocument(LPCTSTR szFilename, bool bVisible=true);
HRESULT NewDocument(bool bVisible=true);
HRESULT CloseActiveDocument(bool bSave=true);
HRESULT CloseDocuments(bool bSave=true);
HRESULT SetSelectionText(LPCTSTR szText);
HRESULT GetSelectionText(LPCTSTR& strText);
HRESULT InserPicture(LPCTSTR szFilename, int iWidth, int iHeight);
HRESULT AddComment(LPCTSTR szComment);
HRESULT MoveCursor(int nDirection=2,bool bSelection=false);
HRESULT DeleteChar(bool bBack=false);
HRESULT CheckSpelling(LPCTSTR szWord, bool &bResult);
HRESULT CheckGrammer(LPCTSTR szString, bool &bResult);
HRESULT SetFont(LPCTSTR szFontName, int nSize, bool bBold, bool bItalic,COLORREF crColor);
HRESULT SaveAs(LPCTSTR fileName);
////word2003
//void SaveAs(VARIANT* FileName, VARIANT* FileFormat, VARIANT* LockComments, VARIANT* Password, VARIANT* AddToRecentFiles, VARIANT* WritePassword, VARIANT* ReadOnlyRecommended, VARIANT* EmbedTrueTypeFonts, VARIANT* SaveNativePictureFormat,
// VARIANT* SaveFormsData, VARIANT* SaveAsAOCELetter, VARIANT* Encoding, VARIANT* InsertLineBreaks, VARIANT* AllowSubstitutions, VARIANT* LineEnding, VARIANT* AddBiDiMarks);
////word2000
//void SaveAs(VARIANT* FileName, VARIANT* FileFormat, VARIANT* LockComments, VARIANT* Password, VARIANT* AddToRecentFiles, VARIANT* WritePassword, VARIANT* ReadOnlyRecommended, VARIANT* EmbedTrueTypeFonts, VARIANT* SaveNativePictureFormat,
// VARIANT* SaveFormsData, VARIANT* SaveAsAOCELetter);
//ActiveDocument.SaveAs FileName := "Hello.doc", FileFormat := wdFormatDocument, LockComments := False, Password := "", AddToRecentFiles := True, WritePassword := "", ReadOnlyRecommended := False, EmbedTrueTypeFonts := False, SaveNativePictureFormat := False, SaveFormsData := False, SaveAsAOCELetter := False
};