Minimum supported Java version is 8.0
docx4j 8 is intended to be easy to deploy in complex environments such as OSGi, JBoss EAP etc. Please post feedback/findings on this in the deployment forums https://www.docx4java.org/forums/deployment-f22/ OSGi users please see https://github.com/plutext/docx4j/blob/master/OSGi.md
Feature-wise, it is the largely the same as 6.1.2.
However, the jars you need have changed! Please read on...
Maven users
Just add one and only one of docx4j-JAXB-Internal, docx4j-JAXB-MOXy,
or docx4j-JAXB-ReferenceImpl dependencies. This will pull in all required deps; the essential parts of docx4j itself
are in the following jars:
- Code: Select all
org.docx4j:docx4j-core:jar:8.0.0
+- org.docx4j:docx4j-openxml-objects:jar:8.0.0
+- org.docx4j:docx4j-openxml-objects-pml:jar:8.0.0
+- org.docx4j:docx4j-openxml-objects-sml:jar:8.0.0
If you are using Java 8 (which includes JAXB), you can generally just use:
Using xml Syntax Highlighting
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-Internal</artifactId>
<version>8.0.0</version>
</dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-Internal</artifactId>
<version>8.0.0</version>
</dependency>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
If you want to use the JAXB Reference Implementation, use:
Using xml Syntax Highlighting
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-ReferenceImpl</artifactId>
<version>8.0.0</version>
</dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-ReferenceImpl</artifactId>
<version>8.0.0</version>
</dependency>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
If you want to use MOXy, use:
Using xml Syntax Highlighting
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-MOXy</artifactId>
<version>8.0.0</version>
</dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-MOXy</artifactId>
<version>8.0.0</version>
</dependency>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
zip files
If you are not using maven, you can download https://docx4java.org/docx4j/docx4j-community-8.0.0.zip
For convenience, that zip file includes the docx4j-JAXB-Internal jar. So if you are using Java 8, that is generally all you need.
If you want to use MOXy or the JAXB Reference Impl, you'll also need either:
https://docx4java.org/docx4j/docx4j-JAXB-MOXy-8.0.0.zip
or https://docx4java.org/docx4j/docx4j-JAX ... -8.0.0.zip
and be sure to exclude the docx4j-JAXB-Internal jar!
Sample code
Sample code is not in Maven Central.
Zip files are available:
docx4j: https://docx4java.org/docx4j/docx4j-sam ... -8.0.0.zip
xlsx4j: https://docx4java.org/docx4j/docx4j-sam ... -8.0.0.zip
pptx4j: https://docx4java.org/docx4j/docx4j-sam ... -8.0.0.zip
You can also find these in the respective sub-directories at https://github.com/plutext/docx4j
Docx4j properties
Sample properties file may be found at https://github.com/plutext/docx4j/blob/ ... properties
Logging
To see docx4j logs, you'll need a concrete logging implementation. Config files for log4j2 and logback may be found at https://github.com/plutext/docx4j/tree/ ... /resources
For convenience, the sample zips include the deps necessary for those 2 logging implementations.
Cheat sheet
https://docx4java.org/docx4j/plutext-do ... e-v800.pdf
Release notes:
docx4j is now a Maven multi-module project.
Various dependencies were updated (some of which require Java 1.8)
OpenDoPE support for XPath 2.0, 3.0 (requires Saxon)
Uses repackaged and mavenized Xalan; see https://github.com/plutext/xalan-j/tree ... ged_Docx4j
(Release notes copied from https://github.com/plutext/docx4j/blob/ ... ANGELOG.md )