导航:首页 > 编程语言 > 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相关的资料

热点内容
在伴伴app里面怎么拜师傅 浏览:942
编程珠玑笔记 浏览:279
结束命令行 浏览:268
力学原理pdf 浏览:734
宏定义编译后不变 浏览:404
如何搞免费服务器 浏览:212
神经系统pdf 浏览:672
如何查看服务器上的数据库服务器 浏览:195
压缩机型号v代表什么 浏览:57
旅游类源码 浏览:867
电脑服务器类型怎么设置 浏览:235
pdf炒股 浏览:791
服务器地址缺少端口号什么意思 浏览:535
下载需要解压的小说用哪个软件 浏览:539
广东分布式服务器云主机 浏览:588
服务器忙打不开怎么办 浏览:20
tif压缩软件 浏览:418
程序员那么可爱陆漓上班第1天 浏览:952
macbookair自带什么app 浏览:706
如何关了加密的软件 浏览:587