如何打开PPT到PDF C#

时间:2013-10-11 07:03:41

标签: c# pdf automation powerpoint

我有自动化代码来生成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)如何以PDF格式打开当前的PPT? (i.e converting it to PDF before saving it)

谢谢大家

0 个答案:

没有答案