1

我有一个自动化代码来生成 PDF

Microsoft.Office.Interop.PowerPoint.Application objApp;
Microsoft.Office.Interop.PowerPoint.Presentations objPresSet;
Microsoft.Office.Interop.PowerPoint._Presentation objPres;
Microsoft.Office.Interop.PowerPoint.Slides objSlides;
Microsoft.Office.Interop.PowerPoint.Slide CurSlide;

objApp = new Microsoft.Office.Interop.PowerPoint.Application();

// code stuff to write to PPT slides

现在导出部分:

Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
ppApp.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations;
Microsoft.Office.Interop.PowerPoint._Presentation oPres;

ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
oPres = ppApp.Presentations.Open(sourcepath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
oPres.SaveAs(Targetpath, PpSaveAsFileType.ppSaveAsPDF, Microsoft.Office.Core.MsoTriState.msoTrue);

在导出时,代码会打开任何保存的 PPT,但不会打开当前正在运行的演示文稿。我的问题是

1)如何将当前的PPT打开为PDF?(i.e converting it to PDF before saving it)

谢谢你们

4

0 回答 0