• Stars
    star
    1,941
  • Rank 23,875 (Top 0.5 %)
  • Language
    Java
  • Created over 12 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

README

What is docx4j?

docx4j is an open source (Apache v2) library for creating, editing, and saving OpenXML "packages", including docx, pptx, and xslx.

It uses JAXB to create the Java representation.

  • Open existing docx/pptx/xlsx
  • Create new docx/pptx/xlsx
  • Programmatically manipulate docx/pptx/xlsx (anything the file format allows)
  • Document generation via variable, content control data binding, or MERGEFIELD
  • CustomXML binding (with support for pictures, rich text, checkboxes, and OpenDoPE extensions for repeats & conditionals, and importing XHTML)
  • Export as HTML
  • Export as PDF, choice of 3 strategies, see https://www.docx4java.org/blog/2020/09/office-pptxxlsxdocx-to-pdf-to-in-docx4j-8-2-3/
  • Produce/consume Word 2007's xmlPackage (pkg) format
  • Apply transforms, including common filters
  • Font support (font substitution, and use of any fonts embedded in the document)

docx4j for JAXB 3.0 and Java 11+

docx4j v11.4.5 uses Jakarta XML Binding API 3.0, as opposed to JAXB 2.x used in earlier versions (which import javax.xml.bind.*). Since this release uses jakarta.xml.bind, rather than javax.xml.bind, if you have existing code which imports javax.xml.bind, you'll need to search/replace across your code base, replacing javax.xml.bind with jakarta.xml.bind. You'll also need to replace your JAXB jars (which Maven will do for you automatically; otherwise get them from the relevant zip file).

Being a JPMS modularised release, the jars also contain module-info.class entries.

To use it, add the dep corresponding to the JAXB implementation you wish to use

  • Maven Central docx4j-JAXB-ReferenceImpl
  • Maven Central docx4j-JAXB-MOXy

docx4j-8

This is docx4j for Java 8. Although in principle it would compile and run under Java 6, some of its dependencies are Java 8 only. So to run it under Java 6, you'd need to use the same version of the deps which docx4j 6.x uses.

docx4j v8 is a multi-module Maven project.

To use docx4j v8, add the dep corresponding to the JAXB implementation you wish to use

  • Maven Central docx4j-JAXB-Internal (shipped in Oracle and OpenJDK v8)
  • Maven Central docx4j-JAXB-ReferenceImpl (you may need to respect the endorsed dir mechanism for the RI jars)
  • Maven Central docx4j-JAXB-MOXy

You should use one and only one of docx4j-JAXB-*

How do I build docx4j?

Get it from GitHub, at https://github.com/plutext/docx4j

mvn clean
mvn install

Some of the tests might fail on Windows. For now, you could skip them: mvn install -DskipTests

For more details, see http://www.docx4java.org/blog/2015/06/docx4j-from-github-in-eclipse-5-years-on/

If you are working with the source code, please join the developer mailing list:

Where do I get a binary?

http://www.docx4java.org/downloads.html

How do I get started?

See the Getting Started guide: https://github.com/plutext/docx4j/tree/master/docs

and the Cheat Sheet: http://www.docx4java.org/blog/2013/05/docx4j-in-a-single-page/

And see the sample code: https://github.com/plutext/docx4j/tree/master/src/samples

You'll probably want the Helper AddIn to generate code: http://www.docx4java.org/blog/2016/05/docx4j-helper-word-addin-new-version-v3-3-0/

Where to get help?

http://www.docx4java.org/forums or StackOverflow (use tag 'docx4j')

Please post to one or the other, not both

Legal Information

docx4j is published under the Apache License version 2.0. For the license text, please see the following files in the legals directory:

  • LICENSE
  • NOTICE Legal information on libraries used by docx4j can be found in the "legals/NOTICE" file.

More Repositories

1

docx4j-ImportXHTML

Converts XHTML to OpenXML WordML (docx) using docx4j
Java
132
star
2

docx4j.NET

docx4j is an open source (ASLv2) library for docx/pptx/xlsx, similar in concept to Open XML SDK, but with its own particular strengths including content control databinding (with OpenDoPE enhancements), XHTML import/export, PDF output, and MERGEFIELD processing. This is the .NET version of docx4j.
C#
65
star
3

AndroidDocxToHtml

docx to html using docx4j on Android 4.0.3 demo project
Java
58
star
4

docx4j-export-FO

Export docx to PDF via XSL FO, using FOP
Java
45
star
5

docx-html-editor

edit a docx using CKEditor via XHTML round trip (with some session state)
Java
43
star
6

Docx4j4Android4

Android Studio docx4j sample app
Java
25
star
7

PDF-Converter-Java

Java client for Plutext's doc/docx to PDF Converter product
Java
14
star
8

OpenDoPE-Mapping-WordAddIn

A Word AddIn (similar to Word 2013's XML Mapping Pane) which handles conditionals etc
C#
13
star
9

jaxb-2_2_5_1

Java
13
star
10

ae-awt

Repackaged AWT sufficient to run repackaged xmlgraphics-commons on Android
Java
12
star
11

docx4all

docx editor (Java Swing)
Java
8
star
12

java-docx-to-pdf-using-Microsoft-Graph

java-docx-to-pdf-using-Microsoft-Graph
Java
8
star
13

OpenDoPE-WAR

Java webapp for binding XML to Word content controls
Java
5
star
14

JAXB-classes-for-xmldsig-core

JAXB classes for xmldsig-core, generated using XJC
5
star
15

OpenDoPE-NoXML-WordAddIn

A Word AddIn for setting up OpenDoPE content controls which doesn't expose XML to the user
C#
5
star
16

docx4j-cloud-GoogleDrive

docx4j integration with Google Drive
Java
4
star
17

ephesoft

Automatically exported from code.google.com/p/ephesoft
Java
4
star
18

JAXB-classes-for-SVG

JAXB classes for SVG 1.1, generated using XJC
Java
3
star
19

JAXB-classes-for-XSL-FO

JAXB classes for XSL FO, generated from Apache FOP's XSD
Java
3
star
20

xrxTracker

a bug/enhancement/issue/task tracker in exist-db, using XForms, REST and XQuery (XRX)
JavaScript
3
star
21

ae-xmlgraphics-commons

xmlgraphics-commons which uses ae-awt in order to run on Android
Java
3
star
22

PlotPing

An open source Windows app to graphically view your latency to any web address as a function of time. Written in C#.
C#
3
star
23

OpenDoPE-Model

library used by the OpenDoPE Word AddIns
C#
2
star
24

JAXBNamespacePrefixMapper

JAXBNamespacePrefixMapper
Java
2
star
25

PdfConverterAndroid

Android client for Plutext's PDF Converter.
Java
1
star
26

docx4j-OSGi-HelloWorld

A sample project using the experimental docx4j OSGi bundle
Java
1
star
27

docx4j-ImportXHTML.NET

.NET version of docx4j-ImportXHTML, thanks to IKVM
C#
1
star
28

docx4j-eXist

docx4j integration with eXist proof of concept
Java
1
star
29

slf4j-net-commons-logging

Unified logging facade for .NET and IKVM'd Java jars, piping SLF4J logs through to https://github.com/net-commons/common-logging
Java
1
star
30

docx4j-MOXy-JAXBContext

jaxb.properties files specifying the EclipseLink MOXy (JAXB) runtime
1
star
31

jaspersoftstudio

Java
1
star