import java.io.File;Run:
import java.io.FileOutputStream;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
public class CreateDocument
{
public static void main(String[] args)throws Exception
{
//Word 文档 blank
XWPFDocument document= new XWPFDocument();
//通过给文档起个名字,在特定路径中创建文档
File nv_fichier = new File(nouveauFichier.docx”);
FileOutputStream out = new FileOutputStream(nv_fichier);
document.write(out);
out.close();
System.out.println(文档 ”+ nv_fichier + 已成功创建”);
}
}
createdocument.docx文档创建成功运行时间表示Word文件创建成功。Java 编译并运行此程序以生成一个名为nouveauFichier.docx跨度> 在您指定的路径中。在我们的例子中,这是我们项目的当前目录。
Please disable your ad blocker and refresh the window to use this website.