VC++でMS Wordを制御するには? - ら ら ら のプログラ this page共著 を参考にしました。後はWordのマクロの記録で生成されるコードを調べました。 Excelの情報量は多いのにWordの方はVBAの書籍さえ少ないのがちょっと悲しかったです

  • Published on
    01-Apr-2018

  • View
    219

  • Download
    7

Transcript

<p>VC++MS Word</p> <p>VC++MS Word</p> <p>[]</p> <p>2002/04/20() 21:28:01</p> <p>VC++MS-Word2000docVBwordExcel</p> <p>Win2000 VC6.0 MFC</p> <p>sara2002/04/22() 08:41:05</p> <p>Word98</p> <p>****** VC++Word **********</p> <p>@ MFCMFC AppWizard-3/6ON</p> <p>A ClassWizard...msword8.olbWord2000msword9.olbOffice\Microsoft Office\Office\</p> <p>B OKmsword8.cpp msword8.h_Application Documents _Document Sections Section Font _ParagraphFormat etc.</p> <p>C enumVC++(T)OLE/COMOLE/COM Object ViewerOLE/COM Object ViewerFileView TypeLib... msword8.olbITypeLib Viewer ViewGroup by type kindEnumsStructs</p> <p>Hello World!WordTest.docC:\tmp\--------------------------------------------------------------------------------CString strFileName = _T("C:\\tmp\\wordtest.doc"); </p> <p>_Application MyWord;MyWord.CreateDispatch("Word.Application"); // MyWord.m_bAutoRelease = TRUE;MyWord.SetVisible(FALSE); // Documents m_documents(MyWord.GetDocuments()); // _Document m_doc(m_documents.Add()); // </p> <p>Selection m_select(MyWord.GetSelection()); // m_select.TypeText("Hello World!\r\n");</p> <p>m_doc.SaveAs(strFileName); // m_doc.ReleaseDispatch();MyWord.Quit(); // MyWord.ReleaseDispatch(); // --------------------------------------------------------------------------------_DocumentSaveAs()--------------------------------------------------------------------------------class _Document : public COleDispatchDriver{...void SaveAs(LPCTSTR FileName, WdSaveFormat FileFormat=wdFormatDocument, BOOL LockComments=FALSE, LPCTSTR Password=NULL, BOOL AddToRecentFiles=FALSE, LPCTSTR WritePassword=NULL, BOOL ReadOnlyRecommended=FALSE, BOOL EmbedTrueTypeFonts=FALSE, BOOL SaveNativePictureFormat=TRUE, BOOL SaveFormsData=FALSE, BOOL SaveAsAOCELetter=TRUE);...}void _Document::SaveAs(LPCTSTR FileName, WdSaveFormat FileFormat, BOOL LockComments, LPCTSTR Password, BOOL AddToRecentFiles, LPCTSTR WritePassword, BOOL ReadOnlyRecommended, BOOL EmbedTrueTypeFonts, BOOL SaveNativePictureFormat, BOOL SaveFormsData, BOOL SaveAsAOCELetter){ static BYTE parms[] = VTS_BSTR VTS_I4 VTS_BOOL VTS_BSTR VTS_BOOL VTS_BSTR VTS_BOOL VTS_BOOL VTS_BOOL VTS_BOOL VTS_BOOL; InvokeHelper(0x66, DISPATCH_METHOD, VT_EMPTY, NULL, parms, FileName, FileFormat, LockComments, Password,AddToRecentFiles, WritePassword,ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter);------------------------------------------------------------------------------WdSaveFormatenumC</p> <p>VC++WordWordVBA</p> <p>2002/04/22() 22:28:16</p> <p>sera</p> <p>sara2002/04/23() 08:36:29</p> <p>http://www1.neweb.ne.jp/wa/junneko/tec/tec001.html</p> <p>http://www1.plala.or.jp/knambo/vc/usecom.html</p> <p>WordVBA</p> <p>MS VBA Programming SeriesAVBA Word97/98</p> <p>Word</p> <p>ExcelWordVBA</p> <p>2002/04/23() 21:32:57</p> <p>[[]]</p> <p>sera</p>

Recommended

View more >