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
5
votes
1 answer

Convert html + css (print media) to msword in java

Here is my situation. I have an html/css (css contains print media properties such as @page, @bottom-center etc) resource which is converted to pdf via flying-saucer just fine. Now, I need to convert the same resource also to msword (doc or docx)…
pleft
  • 7,567
  • 2
  • 21
  • 45
5
votes
2 answers

docx4j XHTMLImporter ignores   (non-breaking space)

The XHTMLImporter from docx4j is not converting   into MS WORD non-breaking spaces. Following code is used: public void convert() throws Exception { String stringFromFile = FileUtils.readFileToString(new File("tmp.xhtml"), "UTF-8"); …
Dave
  • 311
  • 3
  • 4
5
votes
2 answers

ClassNotFoundException: org.docx4j.openpackaging.exceptions.Docx4JException

So here we go again. My head is banging on my PC about few hours, I can't figured out what to do. On my local PC I run the java code from Intellij Idea. It works. Now I have to create jar file to make it able to use on some remote server. I added…
Daria
  • 861
  • 11
  • 29
5
votes
1 answer

Apache FOP returns "The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table"

I'm running a FO file through FOP, and getting an error message below: WARNING: The following feature isn't implemented by Apache FOP, yet: table-layou t="auto" (on fo:table) (See position 2:753) May 22, 2014 11:50:00 AM org.apache.fop.cli.Main…
blackpearl
  • 51
  • 1
  • 5
5
votes
2 answers

How to add merge field in word with docx4j?

I am able to add text and paragraphs to word and also replace any merge fields with text but I need to add a new merge field using docx4j to create a word template. How can I do this? Do I use…
Sujal
  • 671
  • 1
  • 16
  • 34
5
votes
3 answers

docx4j create unnumbered / bullet list

I would like to create an unnumbered list with bullets using docx4j in my Word document. I have found the following code that is supposed to do the work. But whatever I try, the generated list is a numbered list! I use Word 2010, German version and…
LaDude
  • 1,383
  • 1
  • 11
  • 27
5
votes
4 answers

Reading .docx file in java

I am trying to read one file in java, following is the code : public void readFile(String fileName){ try { BufferedReader reader= new BufferedReader(new FileReader(fileName)); String line=null; …
Addict
  • 803
  • 2
  • 9
  • 16
5
votes
6 answers

Cannot use docx4j inside of JBoss 7

I was able to successfully create a simple project with docx4j ( http://www.docx4java.org ). This simple project successfully created and wrote on a .docx document. Now I am trying to accomplish the same thing inside of a bigger project. This…
user633286
  • 51
  • 2
  • 5
5
votes
2 answers

How to apply new line in docx file generation using DOCX4J

By the tutorials that I have seen. I learned how to add text on generating a docx file. but then Every time I add a line of text. I noticed that there is always a space between the first line of text and the second line of text. just like hitting…
Weddy
  • 543
  • 6
  • 10
  • 21
5
votes
3 answers

Save WordprocessingMLPackage to ByteArrayInputStream

How can I save a org.docx4j.openpackaging.packages.WordprocessingMLPackage instance into ByteArrayInputStream, then It can be downloaded from server. Thanks.
user200340
  • 3,301
  • 13
  • 52
  • 74
4
votes
3 answers

Convert docX to a custom XML

I have been trying to convert my docX files to a XML I have custom-made. My users want their data converted to this XML for easier content query in their web app and they want the input to be from their docX. I have tried looking for converter API…
michael
  • 41
  • 1
  • 2
4
votes
1 answer

Duplicating multiple powerpoint slides using docx4j

I'm trying to duplicate a couple slides using docx4j but I am running into some trouble. I have a .pptx file with 3 pages and I am looking to duplicate each page several times. This is my code so far (based off samples from here: …
John
  • 41
  • 2
4
votes
1 answer

Error generating pdf from docx with POI

I want convert a docx to pdf with apache poi, the docx is generated correctly with docx4j. The conversion work fine with simple document, but when I want to convert a more stylized document, POI throws an…
Clement Cuvillier
  • 227
  • 1
  • 7
  • 24
4
votes
1 answer

Docx4j library in Lucee 5.0

Background Docx4j is a Java library which can be used to work with Microsoft Word documents as XML in Java. Our older application, which is written in Coldfusion, already uses this library correctly. Then we moved to the newer software Lucee. This…
RolandMakkelie
  • 355
  • 3
  • 14
4
votes
1 answer

Rejecting re-init on previously-failed class java.lang.Class on Android Lollipop

I am trying to generate PDF/Docx in android. I tried with a lot of libraries: apache poi, docx4j and pdf box but always have this message in the console. Any idea? For example for this example code for docx4j: public class ExportNotebookToWordTask…
1
2
3
60 61