最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java通过POI技术将html转成word

网站源码admin29浏览0评论
private static void inputStreamToWord() throws IOException {
   String content = "<html>" +
      "<head>你好</head>" +
      "<body>" +
      "<table>" +
      "<tr>" +
      "<td>信息1</td>" +
      "<td>信息2</td>" +
      "<td>t3</td>" +
      "<tr>" +
      "</table>" +
      "</body>" +
      "</html>";
   InputStream is = new ByteArrayInputStream(content.getBytes("GBK"));
   OutputStream os = new FileOutputStream("f:\\1.doc");//这里写成自己要输出的路径
   POIFSFileSystem fs = new POIFSFileSystem();
   fs.createDocument(is, "WordDocument");
   fs.writeFilesystem(os);
   os.close();
   is.close();
}
发布评论

评论列表(0)

  1. 暂无评论