iava 實現將office 檔案轉成pdf

2021-08-07 11:32:21 字數 873 閱讀 1935

做乙個專案需要檔案預覽效果,於是將office 檔案轉成pdf 進行預覽,但是在網上找了很多發現很多大神都是用openoffice實現的,本地還要安裝,感覺有點麻煩,難道就沒有第三發就jar支援麼,於是乎找了很久很久終於找到了一片部落格 位址點這裡

com.jacob

jacob

1.18-m2

system

d:/jacob.jar

之後寫乙個util的類來處理轉換

public void ppt2pdf(string srcfilepath, string pdffilepath) throws exception  catch (exception e)  finally 

}comthread.release();

}}public void excel2pdf(string infilepath, string outfilepath) throws exception ;

excel = dispatch.invoke(excels, "open", dispatch.method, obj, new int[9]).todispatch();

// 轉換格式

object obj2 = new object;

dispatch.invoke(excel, "exportasfixedformat", dispatch.method,obj2, new int[1]);

} catch (exception es) finally

if (ax != null) );

ax = null;

}comthread.release();

}}

用C 實現將html檔案轉換為chm檔案

這些天因為工作需要,要將一些html檔案轉換為chm檔案,當然是需要和程式結合在一起。後來找到ndoc,裡頭有一段 是相關的,於是開始分析 寫完之後,總結 主要是利用微軟的hhc.exe來編譯html檔案,程式需要將具體的資料寫入hhp和hhc檔案。主要 如下 public void pilepro...

php實現將上傳word檔案轉為html的方法

上傳頁面 檔案上傳 接收頁面 span class qvctdehjsl 程式設計客棧 html public w3c dtd xhtml 1.0 transitional en 程式設計客棧tml1 dtd xhtml1 transitional.dtd 接收上傳檔案 connstr driver...

用python實現將檔案拷貝到指定目錄

import os import shutil alllist os.listdir u d notes python 資料 for i in alllist aa,bb i.split if python in aa.lower oldname u d notes python 資料 aa bb ...