2012-12-03 51 views
2

當我試圖只保存PPT/PPTX到PDF我得到了味精如下圖所示如何保存只讀ppt到pdf?

enter image description here

低於

一讀的是我的代碼:

 Microsoft.Office.Interop.PowerPoint.Application pptApplication = new Microsoft.Office.Interop.PowerPoint.Application(); 
     pptApplication.DisplayAlerts = PpAlertLevel.ppAlertsNone; 
     Microsoft.Office.Interop.PowerPoint.Presentation pptPresentation = pptApplication.Presentations.Open("E:\\Share Box\\data.pptx", MsoTriState.msoTriStateMixed, 
     MsoTriState.msoFalse, MsoTriState.msoFalse); 

     string temp = pptPresentation.ReadOnly.ToString(); 

     pptPresentation.SaveAs("E:\\Share Box\\"+DateTime.Now.Second.ToString(), PpSaveAsFileType.ppSaveAsPDF, MsoTriState.msoTrue); 

     pptPresentation.Close(); 

     Marshal.FinalReleaseComObject(pptPresentation); 
     pptPresentation = null; 
     pptApplication.Quit(); 

     Marshal.FinalReleaseComObject(pptApplication); 
     pptApplication = null; 

     GC.Collect(); 

有人可以幫助我解決這個問題。

回答