Aspose系列實現docx轉PDF,PPT轉PDF,EXCEL轉PDF


沒有什么營養,就是調用一下這個組件。其實一開始用的是Microsoft.Office.Interop.Excel;Microsoft.Office.Interop.Word

 但是在服務器要注意,服務器要安裝Office的指定版本,具體是哪個版本要看你引用的版本。

而且在服務器調用+com組件,對權限有很多要求。網上有很多答案了,這里主要說aspose

 

using Aspose.Cells;//Excel
using Aspose.Slides;//PPT

public static void ppt2Pdf(string filePath,string savePath){
Presentation ppt = new Presentation(filePath);
ppt.Save(savePath, Aspose.Slides.Export.SaveFormat.Pdf);

}


public static void excel2Pdf(string filePath, string savePath)
{

Workbook excel = new Workbook(filePath);
excel.Save(savePath, Aspose.Cells.SaveFormat.Pdf);
}

 

 

using Aspose.Words; 

Document doc = new Document(serverPath);
doc.Save(savePath);

 

DLL的網盤:鏈接: http://pan.baidu.com/s/1bBeizs 密碼: wfzh

 自己引用轉換就可以了

 

 

不過不管微軟的組件還是Aspose都有缺點。馬上給大家分享NPOI 

使用 NPOI 你就可以在沒有安裝 Office 或者相應環境的機器上對 WORD/EXCEL 文檔進行讀寫


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM