"I've had more success with docx4j than anything else"
"congratulations for the great job, I can do things that I cannot with POI or OpenOffice API !!"
"Now armed with docx4j, it was much easier to use the approach I envisioned to generate Word documents."
"I have been using docx4j over the last month on a new product, and I'm impressed and thankful for how much docx4j does."
"This library gives you everything you need to create/load/edit/write Word docx documents from Java, and comes with a Maven repo, online Javadoc, and nice set of Sample code. What more could you ask for? :-)"
"With docx4j we analyze and enrich each paragraph of a law project containing more than 3000 paragraphs and this is done in less than 10 seconds."
"thanks a lot for your good work. docx4j is easy to use and I like it."
Welcome to docx4j
docx4j is an open source (ASLv2) Java library for creating and manipulating Microsoft Open XML (Word docx, Powerpoint pptx, and Excel xlsx) files.
It is similar to Microsoft's OpenXML SDK, but for Java. docx4j uses JAXB to create the in-memory object representation.
Its emphasis is on power: if the file format supports it, you can do it with docx4j. But first, you'll need to take the time to understand JAXB, and the Open XML file structure
docx4j was created by Plutext Pty Ltd in 2008 - using OpenXML4J for the OPC piece. Plutext still drives the project, but since then docx4j has benefited from contributions from many individuals. The contributors are listed in docx4j's pom.xml.
Key links
Download docx4j, or compare the Docx4j Enterprise Edition
View sample code for docx4j, pptx4j, and xlsx4j
docx4j documentation: cheat sheet ( PDF and Getting Started (PDF)
Search Open XML spec documentation
View the structure of your docx/xsx/pptx, and generate code via our webapp or for docx, locally with our Word AddIn
Get help via our forums or StackOverflow.
News
13 August 2024: docx4j 11.5.0 and -ImportXHTML 11.5.0 released for Java 11 and later. More information.
25 April 2024: docx4j 8.3.11 and -ImportXHTML 8.3.11 released for Java 8. More information.
24 April 2024: docx4j-ImportXHTML 8.3.10 released for Java 8, for use with docx4j 8.3.8. More information.
13 March 2024: docx4j-ImportXHTML 11.4.10 released for Java 11, for use with docx4j 11.4.10 and later. More information.
6 March 2024: docx4j 11.4.11 released (addressing security advisories for commons-compress and batik). More information.
28 February 2024: docx4j 11.4.10, and 8.3.10 (for Java 8) are available. If you are manipulating docx files created in Word subject to Microsoft pushed updates, then you need to upgrade.More information.
16 January 2023: docx4j 11.4.9, and 8.3.9 (for Java 8) are available. More information.
14 Sept 2022: docx4j 11.4.8 (Jakarta JAXB) released (a minor release). More information.
14 Sept 2022: docx4j-ImportXHTML 11.4.8 (Jakarta JAXB) released (a minor release). More information.
8 June 2022: legacy docx4j 8.3.7 released (recommended for v8.x users), addressing issues with charts introduced in v8.3.2. More information.
21 May 2022: docx4j 11.4.7 (Jakarta JAXB) released (a minor release). More information.
16 April 2022: docx4j-ImportXHTML 11.4.6 released for Java 11, also migrating to Jakarta JAXB. More information.
16 April 2022: docx4j 11.4.6 (Jakarta JAXB) released (a minor release). More information.
7 March 2022: docx4j 11.4.5 released, migrating JAXB from javax to jakarta. More information.
3 March 2022: docx4j 8.3.4 released (a minor release), addressing font related issues in 8.3.3's docx4j to PDF via XSL FO. More information.
24 Feb 2022: docx4j 8.3.3 released (a minor release), improving docx4j to PDF via XSL FO. More information.
4 Dec 2021: docx4j 8.3.2 (for Java 8) and 11.3.2 (for JPMS) are available. More information.
12 July 2021: docx4j 8.3.1 released (a minor release). More information.
31 May 2021: docx4j 8.3.0 released. PDF via FO font updates. More information.
19 April 2021: docx4j 11.2.9 is available. If you are a docx4j 11 user manipulating docx files created in Word following recent Microsoft updates, then please upgrade. More information.
15 April 2021: docx4j 8.2.9 is available. Please upgrade if you are writing docx files created following recent Microsoft Word updates. More information.
15 April 2021: docx4j-ImportXHTML 8.2.1 released. Bumps openhtmltopdf version to 1.0.8. More information.
14 Jan 2021: docx4j-ImportXHTML 8.2.0 released. Migrates from FlyingSaucer to openhtmltopdf. More information.
7 Jan 2021: docx4j 11.2.8 for Java 11 released (parity with 8.2.8). More information.
5 Jan 2020: docx4j 8.2.8 released. Just a new KeyMapCustomizationsPart for Microsoft Word.
14 Dec 2020: docx4j 8.2.7 released (a minor release). More information.
7 Dec 2020: docx4j 8.2.6 released (a minor release). More information.
18 Nov 2020: docx4j 11.2.5 for Java 11 released. More information.
13 Nov 2020: docx4j 8.2.4 released (a minor release). More information.
4 Sept 2020: docx4j 8.2.3 released, supporting docx to PDF conversion via Microsoft Graph. More information.
25 Aug 2020: docx4j 8.2.2 released, with support for updating from docvars. More information.
16 July 2020: docx4j 8.2.1 released. More information.
21 June 2020: Docx4j Helper Word AddIn updated, with support for Microsoft's w16 and w16cid namespace prefixes. More information.
10 June 2020: docx4j 8.2.0 released, with support for Microsoft Word conversion via documents4j. More information.
10 June 2020: docx4j 11.1.8 for Java 11 released. More information.
25 May 2020: docx4j 8.1.7 (for Java 8) and 11.1.7 (for JPMS) are available. If you are using docx4j 11.1.7, please upgrade. More information.
7 April 2020: docx4j 8.1.6 is available. Please upgrade if you are writing xlsx files created following recent Microsoft Excel updates. More information.
26 February 2020: docx4j 8.1.5 is available. Please upgrade if you are writing docx files created following recent Microsoft Word updates. More information.
23 December 2019: docx4j 8.1.4 is available. More information.
29 August 2019: docx4j 8.1.3 and 11.1.3 (for Java 11) released. More information.
5 August 2019: docx4j 11.1.2 for Java 11 released. More information.
31 July 2019: docx4j 8.1.2 is available. Please upgrade if two threads in your environment might seek to initialise NamespacePrefixMapper. More information.
30 June 2019: docx4j 8.1.1 is available. Please upgrade if you want to handle xlsx or your default encoding is not UTF-8. More information.
3 June 2019: docx4j 11.1.0 for Java 11 released. More information.
29 May 2019: docx4j 8.1.0 was published in Maven Central on 21 May 2019. More information.
22 April 2019: docx4j 8.0.0 is available in Maven Central. More information.
27 February 2019: docx4j 6.1.2 is available. More information.
21 January 2019: docx4j 6.1.1 is available. More information.
18 December 2018: docx4j 6.1.0 is available. More information.
3 August 2018: docx4j 6.0.1 is available, correcting a significant issue in 6.0.0. More information.
22 July 2018: docx4j 6.0.0 (still supporting Java 6) is available for testing. More information.
14 July 2018: docx4j 3.4.0 release candidate is available for testing. More information.
27 March 2018: docx4j 3.3.7 is available. More information.
6 October 2017: docx4j 3.3.6 is available. More information.
30 June 2017: docx4j 3.3.5 is available, it contains an important fix for Word 2016 documents. More information.
15 June 2017: docx4j 3.3.4 is available. More information.
7 Feb 2017: docx4j 3.3.3 is available. More information.
21 Dec 2016: docx4j 3.3.2 is available. More information.
23 August 2016: Updated Docx4jHelper Word AddIn (vv3.3.1-01) is released. More information.
16 August 2016: docx4j 3.3.1 is available. More information.
11 May 2016: Docx4jHelper Word AddIn v3.3.0 is released. More information.
21 April 2016: docx4j 3.3.0 is available. More information.
4 Sept 2015: docx4j 3.2.2 is released. More information.
10 Feb 2015: High fidelity PDF output.
28 Dec 2014: docx4j-ImportXHTML 3.2.2 is released. More information.
4 Dec 2014: Docx4jHelper Word AddIn is released. More information.
4 October 2014: in-browser editing? See the blog post/demo, and tell us what you want!
3 October 2014: docx4j 3.2.1 is released. More information.
26 August 2014: docx4j 3.2.0 is released. More information.
June 2014: docx4j face to face: London, Budapest, Berlin. More information.
11 May 2014: David Gohel of Lysis Consultants has developed graphical devices for R (statistics package) to DrawingML, using docx4j
23 April 2014: docx4j 3.1.0 released. More information.
21 March 2014: Improvements to Google site search here and across Open XML spec documentation
6 March 2014: docx4j-ImportXHTML.NET 3.0.1 for .NET/C# project on GitHub and in Nuget
5 March 2014: docx4j.NET 3.0.1 for .NET/C# project on GitHub and in Nuget
12 Feb 2014: Docx4j Enterprise Edition consolidates Plutext's MergeDocx, MergePPtx, OLE Helper etc into a single product
10 Feb 2014: docx4j 3.0.1 is available
26 Nov 2013: docx4j 3.0 is available
15 July 2013: Import XHTML code moved into separate project (LGPL)
14 May 2013: docx4j online webapp which can generate docx4j code for you
15 Feb 2013: Commercial support offerings available from Plutext
Getting started
A single A4 page reference/overview of docx4j aka a cheat sheet is available, in PDF or PNG format. It condenses much of the Getting Started guide to a single page.
Our Getting Started guide is available in HTML and PDF, and in Russian ( HTML , PDF).
The HTML version is also available in some other languages (these are machine translations, and from April 2010, so they are a bit dated now):
docx4j ecosystem
docx4all is an open source cross platform WYSIWYG editor for docx files, written in Java Swing and JavaFX Script, released under the GPL
DocxEditorKit can open docx files and display the content in JEditorPane (or JTextPane), and save back to docx format.
docx4j for eclipse-scout. See the HowTo
GDocx is a fluent interface for docx4j.
XPages PDF output
Articles about docx4j
lvdpal's Creating Word documents with Docx4j, which covers tables in some detail
Jos Dirksen's Create complex Word (.docx) documents programatically with docx4j
Glen Smith's Creating Word docx documents dynamically from Grails (or Java)
Свое представление (view) в Spring MVC (Russian)
Thanks people for taking the time to write these articles...