# docx4j

> JAXB-based Java library for Word docx, Powerpoint pptx, and Excel xlsx files

Source: https://talira.ai/catalog/docx4j-mcywg4m2
Every listing: https://talira.ai/catalog.md

- Kind: Open core
- Types: Library
- Categories: [documents / generation / word templates](https://talira.ai/categories/documents/generation/word-templates), [documents / office](https://talira.ai/categories/documents/office), [languages / java](https://talira.ai/categories/languages/java)
- Licence: Apache-2.0[^3][^4]
- Pricing: Free tier[^2][^3]
- Pricing notes: docx4j is Apache-2.0 and free. Docx4j Enterprise Edition (MergeDocx, MergePptx, OLE helper, ChartEx, altChunk merging, support) is sold by Plutext with prices in PDF price lists (EUR or USD); no online licence check.
- Free tier: yes[^2][^3]
- Self-hostable: yes[^3]
- Backed by: [Plutext](https://talira.ai/orgs/plutext.md)

docx4j is a Java library for creating, editing and saving Office Open XML packages (docx, pptx, xlsx), with the XML mapped to Java objects through JAXB. For document generation it supports variable replacement, MERGEFIELDs and content-control data binding to custom XML, with the OpenDoPE extensions for repeats, conditions and components, so a .docx template can be filled from XML data. It exports HTML and PDF (through XSL-FO and Apache FOP, or by driving Word through documents4j or [Microsoft Graph](https://talira.ai/catalog/microsoft-graph-rhyz5wz7.md)), creates charts and anonymises documents. Plutext created it and sponsors it; the library is Apache-2.0, and Plutext sells a Docx4j Enterprise Edition with document merging and support.

## Links

- Website: https://www.docx4java.org/trac/docx4j
- GitHub: https://github.com/plutext/docx4j
- Pricing: https://www.plutext.com/

## Problems it solves

- fill Word content controls from an XML document in a Java service, including repeating table rows
- generate .docx contracts on the JVM where conditions and repeats are marked up in the template itself
- read, change and save Word, PowerPoint and Excel files from Java as typed objects instead of raw XML
- convert generated .docx files to PDF from Java without Word installed
- produce tagged PDF or PDF/A from Word documents in a Java backend
- an Apache-licensed Java alternative to paid Word libraries for document automation
- strip personal data out of a .docx before sharing it, from Java
- create charts inside Word or PowerPoint files from a Java program
- replace MERGEFIELDs in an existing Word template with values from Java

## Features

- open, create and edit docx, pptx and xlsx packages as JAXB objects
- document generation by variable replacement, MERGEFIELD or content-control data binding
- OpenDoPE custom XML binding with repeats, conditionals, pictures, rich text and checkboxes
- import XHTML into Word documents
- export to HTML and to PDF via XSL-FO and Apache FOP (tagged PDF, PDF/A, PDF/UA)
- PDF through Word via documents4j or Microsoft Graph for Word-level fidelity
- create and edit charts in docx, pptx and xlsx
- anonymise or sanitise documents
- font substitution and embedded fonts
- Python package (docx4j on PyPI) with no JVM

## Limitations

- Doesn't read legacy binary Office files such as .doc and .xls: it works with docx, pptx and xlsx[^1]
- Doesn't render PDFs exactly as Word does with its own converter: for Word-identical output it drives Word through documents4j or Microsoft Graph[^1]

## Trust

Overall: 0.27 out of 1.
Signals: backing 0.30, extensibility 0.00.

- backed by Plutext

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [rdocx](https://talira.ai/catalog/rdocx-w47ztd3z.md): Native DOCX creation, editing, comparison, layout, and rendering
- [Carbone](https://talira.ai/catalog/carbone-hz5gt655.md): Generates PDF, DOCX and other documents from JSON data and Office templates
- [Docmosis](https://talira.ai/catalog/docmosis-xet3917k.md): API-first, template-based document generation
- [Sablon](https://talira.ai/catalog/sablon-5bjabghv.md): Ruby document template processor based on docx templates and Mail Merge fields
- [Aspose.Words](https://talira.ai/catalog/aspose-words-4k0hy0ew.md): Create, edit, render and convert Word documents to multiple formats without using external software
- [docxtemplater](https://talira.ai/catalog/docxtemplater-gjcbyhm2.md): Powerful Word, PowerPoint and Excel generation

## Sources

[^1]: https://www.docx4java.org/docx4j-vs-poi-vs-aspose.html (checked 20 Nov 2026)
[^2]: https://www.plutext.com/ (checked 20 Nov 2026)
[^3]: https://github.com/plutext/docx4j/blob/VERSION_17_3_7/README.md (checked 20 Nov 2026)
[^4]: https://github.com/plutext/docx4j/blob/VERSION_17_3_7/legals/LICENSE (checked 20 Nov 2026)
