添加引用:
using Aspose.Cells;
using Aspose.Slides;
using Aspose.Words;
/// <summary> /// PPT轉PDF /// </summary> /// <param name="InPath">輸入路徑</param> /// <param name="OutPath">輸出路徑</param> public void PPT_PDF(string InPath, string OutPath) { Presentation ppt = new Presentation(InPath); ppt.Save(OutPath, Aspose.Slides.Export.SaveFormat.Pdf); } /// <summary> /// Word轉PDF /// </summary> /// <param name="InPath"></param> /// <param name="OutPath"></param> public void Word_PDF(string InPath, string OutPath) { Document doc = new Document(InPath); doc.Save(OutPath, Aspose.Words.SaveFormat.Pdf); } /// <summary> /// Excel轉PDF /// </summary> /// <param name="InPath"></param> /// <param name="OutPath"></param> public void Excel_PDF(string InPath, string OutPath) { Workbook excel = new Workbook(InPath); excel.Save(OutPath, Aspose.Cells.SaveFormat.Pdf); }