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
3
votes
3 answers

Creating a word document from a template dynamically using values from java objects

I want to create a word document from an HTML page. I am planning to get the values on the HTML page and then pass these values to a document template. I have used JSOUP to parse the contents of the HTML page and I get the values in my java…
Sunmit Girme
  • 559
  • 4
  • 13
  • 30
3
votes
1 answer

How to get the data of an embedded document inside a word document in Java

I am using Aspose library node collection to read a Word document node by node, but embedded documents are being identified as node of type shape. How can i get the data inside those documents. Is there any way to achieve this using Aspose words or…
lemon chow
  • 303
  • 8
3
votes
0 answers

Issue in wp:docPr while loading the docx file using docx4j

Processed a docx file which contains image using docx4j. After loading the file I logged document part, I found that "title" attribute is missing inside element. Let me know how to handle this. Thanks in advance Before Docx4j…
3
votes
1 answer

How to resolve java.lang.ClassNotFoundException: org.docx4j.jaxb.ri.NamespacePrefixMapper

I am currently trying to convert a file from html to docx with docx4j library. I have already managed to convert from html to pdf with itext5 but now I am facing an exception trying to convert to docx because of jaxb. My project uses maven so I…
Gosfly
  • 1,240
  • 1
  • 8
  • 14
3
votes
1 answer

Add multiple values on a table using docx4j

The image below describes what I want to do, so I'm supposed to add many values to this three tables. I'm using the library docx4j
3
votes
0 answers

crash app when use docx4j in android studio

I'm developing an app for android. I want create a docx file with my app and i use Docx4j for this job. my app hasn't any error when compiled but when run app and touch button for create file, app is crashed. this is error when…
3
votes
0 answers

Docx4j table column border has space in between using XhtmlImporterImpl

I'm trying to convert HTML into docx using docx4j. I set cellspacing and cellpadding attributes of table to 0. But somehow after I opened the generated document, there's still cellspacing between each cell. I used XHTMLImporterImpl to generate…
additionster
  • 628
  • 4
  • 14
3
votes
1 answer

Trouble integrating docx4j with a JIRA plugin

I've been trying to integrate docx4j with a custom JIRA plugin and I'm having a hell of a time. The first approach was to add: org.docx4j docx4j
Ben
  • 960
  • 8
  • 17
3
votes
1 answer

How to Merge two pptx files having charts and tables using java api?

I have tried merging two pptx files through java API (Apache POI) It worked for PPTX having only text Content. I need help to merge two PPTX files without losing charts, tables, images, Themes etc. Are there any open source java API-s for this?
Anuraag P
  • 31
  • 3
3
votes
2 answers

Prevent Table split in apache poi

I am facing an issue while generating the docx file using apache poi library. I have multiple tables of variable sizes to be included dynamically in the document.The issue is that table gets splited between the pages.My requirement is to prevent the…
3
votes
1 answer

How to set a font for pdf output using Docx4J

I am using Docx4J.toPDF(wordMLPackage, new FOS("path/to/file.pdf")) in order to convert a ".docx" file to ".pdf". Although the conversion is happening fine but the original document had Calibri font and the resultant pdf has Arial. Is there a way to…
Aditya Bahuguna
  • 647
  • 7
  • 22
3
votes
0 answers

ava.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

I am Using docx4j to read Docx file from sd card. I have problem with org.apache.log4j.Logger library. I have even tried to add it externally. but it is still giving me same problem. build.gradle apply plugin: 'com.android.application' android { …
Shvet
  • 1,159
  • 1
  • 18
  • 30
3
votes
3 answers

Docx4j loading docx is giving NullPointerException

I wanted to convert docx to html. I started writing the code same as examples given in github. This is just loading part. There itself I'm getting the problem. import org.docx4j.Docx4J; import…
pinkpanther
  • 4,770
  • 2
  • 38
  • 62
3
votes
3 answers

How can I insert a page break?

I need to insert a page break after printing some paragraphs. I found a function to insert the page break, but it inserts only an empty paragraph and not a page break. This is the function: private static void addPageBreak() { MainDocumentPart…
3
votes
3 answers

How to preserve the HTML when creating a .docx with docx4j?

I've started today using docx4j; I've succesfully created a document with a table, fed with content coming from an external source. This content has simple HTML inside, for example a column may contain a String like: String content =…
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243