Create DOTX File via Java
Native and high performance Microsoft Word DOTX documents creation programmatically using Java library.
Generating MS Word DOTX file dynamically within running application is easy. In order to create DOTX documents from scratch having similar result as of New document in Microsoft Word without requiring MS Office, we’ll use
API that offers different features for document creation, manipulation and conversion using Java platform.
How to Create DOTX via Java
It is easy for the developers to creat, load, modify and convert DOTX files within running Word Automation applications for data processing in just few lines of code.
- Create a Document class object.
- Create DocumentBuilder class object and initialize it with the Document object.
- Save the file using save(.) method.
System Requirements
Before running the Java conversion sample source code, make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with Java Runtime Environment for JSP/JSF Application and Desktop Applications.
- Get latest version of Aspose.Words for Java directly from Maven.
Following source code shows how to create a Word DOTX file using Java.
Document dotx = new Document();
DocumentBuilder builder = new DocumentBuilder(dotx);
builder.write("hello world");
dotx.save("created_file.dotx");
DOTX What is DOTX File Format
Files with DOTX extension are template files created by Microsoft Word to have pre-formatted settings for generation of further DOCX files. A template file is created in order to have specific user settings that should be applied to subsequent flies created from these. These settings include page margins, borders, headers, footers, and other page settings. Such templates are used in official documents such as company letterheads and standardized forms.
Read MoreOther Supported Document Generation
You can also create other Microsoft Word files including few listed below.