public static void main(String[] args) throws Exception{ //创建 POIFSFileSystem 对象 POIFSFileSystem poifs = new POIFSFileSystem(); //获取DirectoryEntry DirectoryEntry directory = poifs.getRoot(); //创建输出流 OutputStream out = new FileOutputStream("D:/test/Pdf.docx"); //创建文档,1.格式,2.HTML文件输入流 directory.createDocument("WordDocument", new FileInputStream("D:/Demo.html")); //写入 poifs.writeFilesystem(out); //释放资源 out.close(); System.out.println("success"); }
输入到指定的文件夹