Questions tagged [docx4j]

Docx4j is an open source (ASLv2) Java library for manipulating Microsoft OpenXML files (Word docx, Powerpoint pptx, and Excel xlsx) via JAXB

Docx4j is a Java library for manipulating Microsoft OpenXML files (Word docx, Powerpoint pptx, and Excel xlsx). It uses JAXB to create the in-memory representation.

It is similar to Microsoft's OpenXML SDK, but for Java. docx4j uses JAXB to create the in-memory object representation.

It is available under the Apache License (v2).

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.

The docx4j online demo is available here.

911 questions
0
votes
1 answer

Microsoft Word Docx Download Attachment Error

I have doc or docx document saved in Unix directory and integrate with web page which allow user to download the attachment. I have following code to stream the character and saves as Word document with correct MIME type but why when open it shows…
nicholas
  • 2,581
  • 14
  • 66
  • 104
0
votes
1 answer

Docx4j buffered image

I am using docx4j to manipulate docx. What im trying to do is make buffered image of every image in all tables. I have instance of org.docx4j.wml.Drawing, is there any way to make buffered image from it? Source codes are mostly downloaded from…
0
votes
1 answer

Null Pointer Exception at OutputPropertiesFactory.java when using docx4j

I am using docx4j to extract an uploaded docx file, but getting the following exception java.lang.NullPointerException at org.apache.xml.serializer.OutputPropertiesFactory.getDefaultMethodProperties(OutputPropertiesFactory.java:260) …
user200340
  • 3,301
  • 13
  • 52
  • 74
0
votes
1 answer

Convert pptx into html view using docx4j

Can anyone help me in converting a pptx into html view using docx4j.jar. Though I have gone through a lot of related questions already asked in this forum but none helped me. Please give me a brief conversion process(just name the related classes…
prateek
  • 440
  • 4
  • 12
0
votes
1 answer

How to setSpace on addParagraphOfText in docx4j?

Is there any way to change any property of a paragraph after I added to the MainDocumentPart ? WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(); MainDocumentPart mdp =…
roncsak
  • 618
  • 1
  • 8
  • 21
0
votes
1 answer

docx4j - Nodes Omitted From XmlUtils.marshalToString()

Using XMLUtils.marshalToString() from docx4j, I have the following content at identical locations in two docx files (extracted from corresponding word/document.xml after unzipping the .docx). These are the only differences between the files:
Jacob Zwiers
  • 1,092
  • 1
  • 13
  • 33
0
votes
1 answer

docx4j Differencer Showing More Differences Than Expected

I have two documents: Document 1 (input) Document 2 (output) Document 2 is the result of passing Document 1 through a transformation process which leaves any content and formatting intact (verified by side-by-side compare in Word). However, the…
Jacob Zwiers
  • 1,092
  • 1
  • 13
  • 33
0
votes
1 answer

Obtain Details of docx4j Comparison

I took the suggestion for comparing docx files from here: OutOfMemoryError while doing docx comparison using docx4j However, this line: Body newBody = (Body) org.docx4j.XmlUtils.unmarshalString(contentStr); triggers a number of JAXB Warnings such…
Jacob Zwiers
  • 1,092
  • 1
  • 13
  • 33
0
votes
1 answer

Java docx4j Bold Text

I do a search and replace on a word document by using docx4j and the following code: WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new File(pathFinder.findUploadPath() + filename)); //Get all text elements out of the…
Basti Kölni
  • 25
  • 2
  • 6
0
votes
1 answer

Converting formula/equation in docx to html using docx4j

I'm trying to convert docx containing equations to on Android. I came across docx4j which is great and tested the following sample…
pzo
  • 2,087
  • 3
  • 24
  • 42
0
votes
1 answer

Error in running docx4j createhtml.java file

C:\Users\Agastheswar\Desktop\RESUME2.docx log4j:WARN No appenders could be found for logger (org.docx4j.utils.ResourceUtils). log4j:WARN Please initialize the log4j system properly. log4j:WARN See…
user1162040
  • 169
  • 2
  • 3
  • 5
-1
votes
0 answers

The generated class names are all numbers

enter image description here How to customize and add a class name prefix?thank you! WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(wordIs); OutputStream os = new ByteArrayOutputStream(); HTMLSettings htmlSettings =…
-1
votes
1 answer

Adding images to a DOCX

I have a template DOCX file that I am working with. The template file contains two placeholders for images (a logo and a barcode image). How can I replace these images using BufferedImage or just getting an image from a URL? There seem to not be…
javalove
  • 560
  • 3
  • 9
-1
votes
1 answer

Docx4j replace image with another image

I've been working on this issue for a while now and I don't find any solution to it. I'm trying to replace a placeholderimage with another image, I found this code on another question and modified it a little but on execution the image field is…
Leevy
  • 1
  • 1
-1
votes
1 answer

How to add new line in replacement string - Docx4j

I'm using Docx4j with Java/Spring and i've built a service that replaces some placeholders in a document with variable values. So in my docx I have a "placeholder" like this: [address] that I'm replacing with 5 different variables combined. My code…