java通过POI技术将html转成word

private static void inputStreamToWord() throws IOException {String content"<html>" "<head>你

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();
}

发布者:admin,转转请注明出处:http://www.yc00.com/web/1733522183a3690354.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信