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();
}
发布评论