This showcase project demonstrates how to convert an HTML document to DOCX using GroupDocs.Editor for Java (version 26.1). It provides a ready‑to‑run Maven‑based Java application that:
- Loads a GroupDocs license (if available).
- Reads an HTML file from
resources/input/. - Converts the HTML to DOCX.
- Saves the resulting DOCX file to
resources/output/.
The goal is to illustrate a typical editing workflow where a web‑based HTML document is turned into an editable Word document.
- Java Development Kit (JDK) 8 or higher
- Maven 3.6+
- Internet connection for Maven to download dependencies (the GroupDocs repository is defined in the
pom.xml).
GroupDocs products require a license. You can obtain a free 30‑day temporary license for evaluation:
- Visit: https://purchase.groupdocs.com/temporary-license/
- Download the license file (e.g.,
GroupDocs.Editor.lic). - Place the license file in the project root directory (the same folder that contains
pom.xml).
Without a license the library runs in evaluation mode. Expect watermarks and functional limitations.
groupdocs-editor-java-html-to-docx-editing-workflow/
├── pom.xml
├── README.md
├── src/
│ └── main/java/com/groupdocs/editor/examples/HtmlToDocxEditingWorkflowExample.java
└── resources/
├── input/
│ └── sample.html # Sample input file (replace with your own HTML)
└── output/ # Generated DOCX files will be placed here
resources/input/– Put the HTML files you want to convert here.resources/output/– The converted DOCX files will be created in this folder automatically.
-
Clone the repository (or copy the project files to a new directory).
git clone <repository‑url> cd groupdocs-editor-java-html-to-docx-editing-workflow
-
Place your license file (optional).
- Copy
GroupDocs.Editor.licinto the project root.
- Copy
-
Build the project and download dependencies.
mvn clean compile
-
Run the example.
- Using Maven Exec plugin:
mvn exec:java
- Using Maven Exec plugin:
-
Check the output.
- After a successful run you will find
sample.docxinsideresources/output/.
- After a successful run you will find
# Assuming you are in the project root directory
mvn exec:javaThe console will display messages indicating whether the license was loaded, the conversion progress, and the location of the generated DOCX file.
- Input file: Replace
resources/input/sample.htmlwith any HTML document you need to convert. - Output name: Modify the
outputPathvariable insideHtmlToDocxEditingWorkflowExample.javaif you want a different filename or location. - Editor configuration: The
EditorConfiginstance can be customized (e.g., setting custom fonts, enabling/disabling specific features). Refer to the GroupDocs.Editor API documentation for more options.
- This is a showcase project intended for learning and quick prototyping. For production scenarios consider adding more robust error handling, logging, and configuration management.
- Ensure that the GroupDocs repository URL (
https://releases.groupdocs.com/java/repo/) is reachable from your network; otherwise Maven will not be able to fetch thegroupdocs-editorartifact.
Happy coding!