调用PowerPoint的Dispatch接口,将PPT装换为图片

//首先导入一堆的东西 #import "MSO9.DLL" named_guids, rename("RGB", "MsoRGB") #import "VBE6EXT.OLB" #import "MSPPT9.OLB" / rename("RGB", "MsoRGB") / rename("DialogBox", "MsoDialogBox") / rename("CopyFile", "MsoCopyFile") / rename("ReplaceText", "MsoReplaceText") / rename("ExitWindows", "MsoExitWindows"), / rename("FindText", "MsoFindText") // 然后使用VS生成MSPPT9.OLB中的Dispatch包装类,当然,你也可以自己用最原始的接口写。 { CApplication oApp; if( !oApp.CreateDispatch( _T("PowerPoint.Application")) ) { AfxMessageBox( _T("无法启动PowerPoint,请确认您的机器上已经正确安装PowerPoint!") ); return; } { CPresentations oPresentations(oApp.get_Presentations()); LPDISPATCH lpDispPresentation = oPresentations.Open( m_strFilePath, TRUE, 0L, FALSE); if( lpDispPresentation == NULL ) AfxMessageBox( _T("打开文件失败!") ); else { CPresentation oPresentation(lpDispPresentation); const LPCTSTR OUTPUT_FILE_FORMAT = _T("png"); const long OUTPUT_IMG_WIDTH = 1024; const long OUTPUT_IMG_HEIGHT = 768; oPresentation.Export( strPath, OUTPUT_FILE_FORMAT, OUTPUT_IMG_WIDTH, OUTPUT_IMG_HEIGHT); oPresentation.Close(); } } oApp.Quit(); }

 

   office版本号                           类型库
--------------------------------------------------

Microsoft Access 97 Msacc8.olb
Microsoft Jet Database 3.5 DAO350.dll
Microsoft Binder 97 Msbdr8.olb
Microsoft Excel 97 Excel8.olb
Microsoft Graph 97 Graph8.olb
Microsoft Office 97 Mso97.dll
Microsoft Outlook 97 Msoutl97.olb
Microsoft PowerPoint 97 Msppt8.olb

Microsoft Word 97 Msword8.olb
Microsoft Access 2000 Msacc9.olb
Microsoft Jet Database 3.51 DAO360.dll
Microsoft Binder 2000 Msbdr9.olb
Microsoft Excel 2000 Excel9.olb
Microsoft Graph 2000 Graph9.olb
Microsoft Office 2000 Mso9.dll
Microsoft Outlook 2000 Msoutl9.olb
Microsoft PowerPoint 2000 Msppt9.olb
Microsoft Word 2000 Msword9.olb

Microsoft Access 2002 Msacc.olb
Microsoft Excel 2002 Excel.exe
Microsoft Graph 2002 Graph.exe
Microsoft Office 2002 MSO.dll
Microsoft Outlook 2002 MSOutl.olb
Microsoft PowerPoint 2002 MSPpt.olb
Microsoft Word 2002 MSWord.olb

Microsoft Office Access 2003 Msacc.olb
Microsoft Office Excel 2003 Excel.exe
Microsoft Graph 2003 Graph.exe
Microsoft Office 2003 MSO.dll
Microsoft Office Outlook 2003 MSOutl.olb
Microsoft Office PowerPoint 2003 MSPpt.olb
Microsoft Office Word 2003 MSWord.olb

你可能感兴趣的:(Microsoft,Excel,Office,Graph,output,powerpoint)