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 = 새 FileOutputStream(nv_fichier);
document.write(출력);
out.close();
System.out.println("문서 "+ nv_fichier +"가 성공적으로 생성되었습니다.");
}
}
createdocument.docx 문서가 성공적으로 작성되었습니다실행 시간은 Word 파일이 성공적으로 작성되었음을 나타냅니다. Java는 이 프로그램을 컴파일하고 실행하여 이름이 지정된 빈 Word 파일을 생성합니다. nouveauFichier.docx스팬> 지정한 경로에서. 우리의 경우 이것은 프로젝트의 현재 디렉토리입니다.
Please disable your ad blocker and refresh the window to use this website.