導航:首頁 > 編程語言 > javahtmlxml

javahtmlxml

發布時間:2025-02-06 20:32:03

① 如何在java中將XML文檔轉換成HTML文檔

貼上代碼:
mport java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import com.artofsolving.jodconverter.DefaultDocumentFormatRegistry;
import com.artofsolving.jodconverter.DocumentConverter;
import com.artofsolving.jodconverter.DocumentFormatRegistry;
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;

public class test {

/**
* @param args
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
test t = new test();
//File in = new File("d:\\mytest\\test1.pdf");
//File out = new File("d:\\mytest\\test11.html");
FileInputStream input = new FileInputStream("d:\\mytest\\test11.pdf");
FileOutputStream output = new FileOutputStream("d:\\mytest\\test11.doc");

t.convert(input, output);
}

public void convert(File input, File output) throws Exception

{

OpenOfficeConnection conn = new SocketOpenOfficeConnection("localhost", 8100);

conn.connect();

DocumentConverter converter = new OpenOfficeDocumentConverter(conn);

converter.convert(input, output);

conn.disconnect();

}

public void convert(InputStream input, OutputStream output) throws Exception

{

OpenOfficeConnection conn = new SocketOpenOfficeConnection("localhost", 8100);

conn.connect();

DocumentConverter converter = new OpenOfficeDocumentConverter(conn);

DocumentFormatRegistry registry = new DefaultDocumentFormatRegistry();

converter.convert(input, registry.getFormatByFileExtension("pdf"), output, registry.getFormatByFileExtension("doc"));

conn.disconnect();

}
}

閱讀全文

與javahtmlxml相關的資料

熱點內容
rsa驗簽php源碼 瀏覽:514
github怎麼直接打開源碼 瀏覽:529
和家親app怎麼下載不了了 瀏覽:728
藍屏程序員 瀏覽:78
androidinflatexml 瀏覽:489
魔獸爭霸2下載好了怎麼解壓 瀏覽:920
怎麼做少女心解壓本 瀏覽:203
php刷新cookie 瀏覽:737
推薦伺服器怎麼關閉 瀏覽:615
dos命令隱藏窗口 瀏覽:591
三國志13用什麼解壓 瀏覽:979
單片機水霧化的方法 瀏覽:248
解出來為2的加密方式 瀏覽:477
android網銀支付開發 瀏覽:634
最小樹演算法 瀏覽:264
如何分辨鴻蒙應用和安卓應用 瀏覽:557
網頁訪問雲伺服器ftp 瀏覽:535
蘋果如何和安卓更換系統 瀏覽:880
刪除主網站源碼 瀏覽:335
單片機怎麼拔 瀏覽:548