Skip to content

Latest commit

 

History

History
99 lines (73 loc) · 3.52 KB

File metadata and controls

99 lines (73 loc) · 3.52 KB

groupdocs-editor-java-html-to-docx-editing-workflow

Overview

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:

  1. Loads a GroupDocs license (if available).
  2. Reads an HTML file from resources/input/.
  3. Converts the HTML to DOCX.
  4. 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.


Prerequisites

  • 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).

License

GroupDocs products require a license. You can obtain a free 30‑day temporary license for evaluation:

Without a license the library runs in evaluation mode. Expect watermarks and functional limitations.


Project Structure

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.

Setup & Execution

  1. 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
  2. Place your license file (optional).

    • Copy GroupDocs.Editor.lic into the project root.
  3. Build the project and download dependencies.

    mvn clean compile
  4. Run the example.

    • Using Maven Exec plugin:
      mvn exec:java
  5. Check the output.

    • After a successful run you will find sample.docx inside resources/output/.

Example Usage

# Assuming you are in the project root directory
mvn exec:java

The console will display messages indicating whether the license was loaded, the conversion progress, and the location of the generated DOCX file.


Customization

  • Input file: Replace resources/input/sample.html with any HTML document you need to convert.
  • Output name: Modify the outputPath variable inside HtmlToDocxEditingWorkflowExample.java if you want a different filename or location.
  • Editor configuration: The EditorConfig instance can be customized (e.g., setting custom fonts, enabling/disabling specific features). Refer to the GroupDocs.Editor API documentation for more options.

Notes

  • 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 the groupdocs-editor artifact.

Happy coding!