jacob是java和windows下的com橋
package com;
/**
* <p>Title:Word文檔轉html類</p>
* <p>Description: </p>
* <p>Copyright:()
* @author 舵手
* @version
*/
import
import com
public class WordtoHtml {
/**
*文檔轉換函數
*@param docfile word文檔的絕對路徑加文件名(包含擴展名)
*@param htmlfile 轉換後的html文件絕對路徑和文件名(不含擴展名)
*/
public static void change(String docfile
ActiveXComponent app = new ActiveXComponent(
try {
app
//設置word不可見
Object docs = app
Object doc = Dispatch
// 打開word文件
Dispatch
// 作為html格式保存到臨時文件
Variant f = new Variant(false);
Dispatch
} catch (Exception e) {
e
} finally {
app
}
}
public static void main(String[] strs){
WordtoHtml
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26160.html