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
22
votes
4 answers

Apache POI or docx4j for dealing with docx documents

What do you think Which is better to use to read docx document as java objects and why ? in other words. which library supports most of the word tags ?
becks
  • 2,656
  • 8
  • 35
  • 64
19
votes
7 answers

Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException

I am building my android project when i got this error after import docx4j library in my project. What should i do to get rid of this exception. Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException:…
Wahib
  • 259
  • 1
  • 2
  • 8
10
votes
1 answer

How to center text in docx4j

I have a paragraph of text which I would like to appear in the center of the document. How can I do this in docx4j? I am currently using: PPr paragraphProperties = factory.createPPr(); //creating the alignment TextAlignment align = new…
Nick
  • 1,743
  • 6
  • 23
  • 38
10
votes
3 answers

docx4j does not replace variables

I just followed approach No 2 in the VariableReplace example from docx4j 2.8.1 and everything it does, is to remove the variable markers ${}. The steps I did: Opened Word 2013, typed ${variable} as text only Saved it to somewhere read it in my Java…
Martin Dames
  • 264
  • 3
  • 13
9
votes
1 answer

How to copy a paragraph of .docx to another .docx with Java and retain the style

I am trying to copy the content from a particular paragraph in a .docx to another empty .docx .the problem i have is that the style,bullets,numbering etc from the source.docx is not retained in the destination .docx.Here is my code can anyone please…
Dharmin
  • 91
  • 1
  • 1
  • 3
8
votes
3 answers

Docx4j: Convert to PDF deprecated

The "getting started" document of docx4j contains sample code to write a docx to pdf: // Set up converter org.docx4j.convert.out.pdf.PdfConversion c = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage); However, as of docx4j…
gexicide
  • 38,535
  • 21
  • 92
  • 152
7
votes
1 answer

Convert docx file into PDF with Java

I'am looking for some "stable" method to convert DOCX file from MS WORD into PDF. Since now I have used OpenOffice installed as listener but it often hangs. The problem is that we have situations when many users want to convert SXW,DOCX files into…
Ferguson
  • 527
  • 1
  • 11
  • 29
7
votes
2 answers

Docx4j - How to replace placeholder with value

I've been trying to work through the examples FieldMailMerge and VariableReplace but can't seem to get a local test case running. I'm basically trying to start with one docx template document and have it create x docx documents from that one…
Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192
7
votes
3 answers

"img" must be terminated by the matching end-tag

When parsing some an XSL XML file using docx4j, I keep receiving this error: 'The element type "img" must be terminated by the matching end-tag "". Exception Error in Docx4JException' I have tried all sorts of combinations to solve the…
snowstreams
  • 575
  • 2
  • 13
  • 23
6
votes
2 answers

How to add multiple rows to a table with docx4j

I have a table and I need to add multiple rows to it instead of the variables you see in the image. I'm using docx4j. I change variables like this: HashMap mappings = new HashMap(); VariablePrepare.prepare(template); mappings.put("example",…
Dan
  • 63
  • 1
  • 7
6
votes
1 answer

How to convert office documents into html in android

could we convert microsoft office documents(doc, docx, ppt, pptx, xls, xlsx, etc.) in to html string in Android. i need to show office documents in my app. i have searched and found docx4j, apache poi and…
user3472378
6
votes
2 answers

Create table with docx4j

I try to create a new table depending on input data and insert it into an docx-document. Following leads to a corrupted output file: private Tbl getSampleTable(WordprocessingMLPackage wPMLpackage) { ObjectFactory factory =…
user1335772
  • 277
  • 1
  • 3
  • 10
6
votes
3 answers

How to replace EclipseLink 2.3.2 with EclipseLink 2.5 in WebLogic Server 12c

I currrently try to run Docx4j in WebLogic Server 12c. WebLogic Server 12c comes with EclipseLink 2.3.2. There is a similar Post describing the situation which unfortunately yield no answer. Docx4j does not work with the JAXB (MOXy) implementation…
Sascha Handke
  • 81
  • 1
  • 5
5
votes
1 answer

docx4j: docx to pdf conversion - docx content not appearing page by page to pdf

Issue: Converting docx to pdf using DOCX4J. Issues is content of docx not getting converted page by page to pdf documents. Few lines are get of page 2 is appearing in page 1 of pdf. pom.xml: org.docx4j
Prabhu Patel
  • 69
  • 1
  • 2
  • 4
5
votes
2 answers

Reading equations & formula from Word (Docx) to html and save database using java

I have a word/docx file which has equations as under images I want read data of file word/docx and save to my database and when need I can get data from database and show on my html page I used apache Poi for read data form docx file but It can't…
NHT
  • 166
  • 3
  • 16
1
2 3
60 61