欢迎来到天天文库
浏览记录
ID:37846051
大小:43.00 KB
页数:4页
时间:2019-06-01
《java调用POI实现word转HTML》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1,导jar包。2,Word2Html.java1.package com.poi; 2.import java.io.BufferedWriter; 3.import java.io.File; 4.import java.io.FileInputStream; 5.import java.io.FileNotFoundException; 6.import java.io.FileOutputStream; 7.import java.io.IOException; 8.impo
2、rt java.io.OutputStream; 9.import java.io.OutputStreamWriter; 10.import java.util.List; 11. 12.import javax.xml.parsers.DocumentBuilderFactory; 13.import javax.xml.parsers.ParserConfigurationException; 14.import javax.xml.transform.OutputKeys;
3、 15.import javax.xml.transform.Transformer; 16.import javax.xml.transform.TransformerException; 17.import javax.xml.transform.TransformerFactory; 18.import javax.xml.transform.dom.DOMSource; 19.import javax.xml.transform.stream.StreamResult; 20.
4、 21.import org.apache.commons.io.output.ByteArrayOutputStream; 22.import org.apache.poi.hwpf.HWPFDocument; 23.import org.apache.poi.hwpf.converter.PicturesManager; 24.import org.apache.poi.hwpf.converter.WordToHtmlConverter; 25.import org.apache.poi.
5、hwpf.model.PicturesTable; 26.import org.apache.poi.hwpf.usermodel.CharacterRun; 27.import org.apache.poi.hwpf.usermodel.Paragraph; 28.import org.apache.poi.hwpf.usermodel.Picture; 29.import org.apache.poi.hwpf.usermodel.PictureType; 30.import org.a
6、pache.poi.hwpf.usermodel.Range; 1.import org.apache.poi.hwpf.usermodel.Table; 2.import org.apache.poi.hwpf.usermodel.TableCell; 3.import org.apache.poi.hwpf.usermodel.TableIterator; 4.import org.apache.poi.hwpf.usermodel.TableRow; 5.import org.w3c.
7、dom.Document; 6./** 7. * @author: Chembo Huang 8. * @since: May 3, 2012 9. * @modified: May 3, 2012 10. * @version: 11. */ 12.public class Word2Html { 13. 14. public static void main(String argv[]) { 15. try { 16. conver
8、t2Html("E://test//33.doc","E://test//abc.html"); 17. } catch (Exception e) { 18. e.printStackTrace(); 19. } 20. } 21
此文档下载收益归作者所有