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

docx4j - delete wml P element

I'm using docx4j to work with a Microsoft Word template. I want to know how to either remove or hide a P element in the template. I'm able to traverse the code to get a specific P element, now I need to know how to remove or hide that P element. Can…
user1358852
4
votes
1 answer

docx4j - Why is the text truncated of spaces?

Here is the code: P para = factory.createP(); R run = factory.createR(); Text text = factory.createText(); text.setValue( " abc " ); run.getContent().add( text ); para.getContent().add( run ); …
CDT
  • 10,165
  • 18
  • 66
  • 97
4
votes
1 answer

Android - docx4j build issue

I am developing an android application. In which I need to show the docx, xlsx files inside my application. I have searched in the internet and found docx4j will convert docx, xlsx files to html (or) pdf. So that I am planning to show the html…
SKK
  • 1,705
  • 3
  • 28
  • 50
4
votes
2 answers

How to save images from a word document in DOCX4J

I'm trying to traverse through a word document and save all the images found in the word document. I tried uploading the sample word document to the online demo and noticed that images are listed as: /word/media/image1.png rId5 …
birdy
  • 9,286
  • 24
  • 107
  • 171
4
votes
2 answers

How to create or update table of contents in a word file?

I can read or write word document in Java using Apache POI or docx4j. But I cant find any references to create or update table of contents in a Word file. Is there any other API can support TOC in Java? Or, is it possible in Apache POI or docx4j to…
Ramakrishna
  • 426
  • 7
  • 26
4
votes
1 answer

Cannot use docx4j on Wildfly 8

I just upgraded the server from JBoss AS 7.1 to WildFly 8. After a lot of migrating work everything works fine except docx4j. I always get the following exceptions. Does anyone have an idea? Failed to define class…
Manuela
  • 1,379
  • 3
  • 16
  • 25
4
votes
1 answer

I'm trying to add image to new word doc with docx4j

I'm trying to add image to new word document using docx4j. I've taken this code from online and modified it for my program, however I receive a strange error and I'm not sure what is causing it or how to debug it... Here's my code private static…
Yury Lankovskiy
  • 143
  • 3
  • 14
4
votes
1 answer

how to convert HTML to .docx using docx4j?

I read some articles about the conversion of html to .docx and I found out that docx4j gives pretty decent results. I wonder if anyone could provide me the following info: Needed jars and versions. Sample code for conversion from html to…
Jalal Sordo
  • 1,605
  • 3
  • 41
  • 68
4
votes
1 answer

Doc4j - Having issues converting docx to PDF with tables in the document

I just tried to a docx document through docx4j's sample webapp at: http://webapp.docx4java.org/OnlineDemo/docx_to_pdf_fop.html the resulting PDF file had the tables incorrectly formatted. In fact the tables were significantly off... I'm just…
Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192
4
votes
3 answers

Docx4J get header/footer elements from docx file and modify them

I am using Docx4J to modify docx templates and put values in place of placeholders in the template that are predefined. so far, i had been successful in finding and replacing paragraphs and texts, tables, images etc. But i am not yet successful in…
Waqas Memon
  • 1,247
  • 9
  • 22
4
votes
2 answers

how to put images at a certain place in the Word(.docx) file by using DOCX4J in java

I have a requirement that I have a Word(.DOCX) file. by using a java program i need to put an image at a certain place in the document by using DOCX4J. can anyone please help me!!! I'm trying with the following code... final String XPATH =…
Nani
  • 45
  • 1
  • 4
4
votes
1 answer

how to create a new word from template with docx4j

I have the following scenario, and need some advice: The user will input a word document as a template, and provide some parameters in runtime so i can query my database and get data to fill the document. So, there are two basic things i need to…
wilson
  • 281
  • 6
  • 22
4
votes
1 answer

Change the page orientation in middle of doc

I need to set landscape to some pages of a document. I tried this code: SectPr sectionLandscape = objectFactory.createSectPr(); String rsidR = sectionLandscape.getRsidR(); SectPr sectionPortrait =…
phew
  • 55
  • 7
4
votes
1 answer

How to remove all comments from docx file with docx4j?

I'd like to remove all the comments from a docx file using docx4j. I can remove the actual comments with a piece of code like is shown below, but I think I also need to remove the comment references from the main document part as well (otherwise…
user2048466
  • 185
  • 3
  • 13
4
votes
1 answer

XMLDirectMapping - No conversion value provided

docx4j (which I host) is typically used with the Sun/Oracle JAXB implementation; the classes of interest below were generated using XJC. Following on from an earlier issue which the MOXy guys kindly fixed, I'm continuing to try to get it working…
JasonPlutext
  • 15,352
  • 4
  • 44
  • 84
1 2
3
60 61