導航:首頁 > 編程語言 > 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相關的資料

熱點內容
wordtopdf轉換 瀏覽:840
雲伺服器在哪設置ftp 瀏覽:620
黑客社會工程學攻擊pdf 瀏覽:996
專業中穎單片機程序開發 瀏覽:424
python多進程多線程實例 瀏覽:637
山東濟南生產伺服器雲主機 瀏覽:310
演算法員跳槽四年 瀏覽:730
秦九昭演算法v0怎麼求 瀏覽:384
斗魚java 瀏覽:896
程序員對老師的感謝 瀏覽:29
什麼app能查看銀行卡照片 瀏覽:24
win7pdf虛擬列印 瀏覽:332
程序員喜歡的女生條件 瀏覽:123
阿里雲伺服器ip搭建教程 瀏覽:85
解壓和拉伸這一動畫的原理是什麼 瀏覽:740
tbc戰士的命令怒吼 瀏覽:481
idea快捷鍵看源碼 瀏覽:976
手機碎屏解壓工具 瀏覽:245
jsonrpcphp使用 瀏覽:566
網上求職系統源碼 瀏覽:699