添加引用:
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); }