A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/javaexamples/create_blank_word_document.htm below:

How to create a blank word document using Java

How to create a blank word document using Java Problem Description

How to create a blank word document using Java.

Solution

Following is the program to create a blank word document using Java.

import java.io.File;
import java.io.FileOutputStream;
import org.apache.poi.xwpf.usermodel.XWPFDocument;

public class CreateWordDocument {
   public static void main(String[] args)throws Exception {
      
      //Blank Document
      XWPFDocument document = new XWPFDocument();

      //Write the Document in file system
      FileOutputStream out = new FileOutputStream (
         new File("C:/poiword/createdocument.docx"));
      
      document.write(out);
      out.close();
      
      System.out.println("createdocument.docx written successully");
   }
}
Output

java_apache_poi_word


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4