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

docx4j how to convert embedded doc properties into simple text while converting docx to pdf

I wanted to know how can I convert by docx4j a displayed doc property into "simple text". My document schema is as the following: Full Name: [DOCPROPERTY] [DOCPROPERTY] Date and Place of Birth: [DOCPROPERTY] [DOCPROPERTY] The main issue is that…
Fseee
  • 2,476
  • 9
  • 40
  • 63
0
votes
1 answer

Merging HTML, RTF to Docx using Docx4J

I'm new to Docx4j and I need some advice. Currently I'm creating a simple (X)HTML document with Java. It contains some information from a database. After creating this html, Docx4j creates a Word-Docx file by using a very simple word template. This…
0
votes
1 answer

convert AngularJS to word document

I have in my disposal a Spring MVC backed server, using AngularJS in client side to display dynamic content. Was researching possibility to get current content displayed in the browser and convert it to a word document. I assume there's a way to do…
bks
  • 1,886
  • 1
  • 24
  • 43
0
votes
2 answers

Sample code for docx4j, java and MS Word templates

I'm starting to work with some content controls (using the Developer Tools menu) in a MS Word .dotx template. What I would like to do is add some text programatically using Java and the docx4j library. Does anyone know where I can find code examples…
user1358852
0
votes
1 answer

Error when converting DOCX to PDF with Docx4j

I am attempting to convert a DOCX file to PDF with Docx4J and receiving two distinct exceptions for two different documents. 1) For document 1, a NullPointerException occurs at…
Dan Torrey
  • 1,379
  • 15
  • 25
0
votes
0 answers

Exception created : java.lang.NoClassDefFoundError: org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage (initialization failure)

I am getting the following error on a linux server machine. On my local machine it works just fine. Exception created : java.lang.NoClassDefFoundError: org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage (initialization…
0
votes
1 answer

docx4j traversalutil finds no TextElements in the Paragraph node

Edit: I know what a NullPointerException is, the problem is, that docx4j don't finds any elements in the Paragraph Node. I'm trying to get the first element of the Text Class in a paragraph. ClassFinder finder = new ClassFinder(P.class); new…
user2147674
  • 2,319
  • 2
  • 14
  • 17
0
votes
1 answer

Convert HTML code to Word Using docx4j Image is not embedded in Word document

Sample program... import java.io.IOException; import org.docx4j.Docx4jProperties; import org.docx4j.jaxb.Context; import org.docx4j.openpackaging.contenttype.ContentType; import org.docx4j.openpackaging.exceptions.Docx4JException; import…
0
votes
1 answer

Docx4j - indent table

I have a nice little problem with docx4j. I have a document which I build from a template (replace MailMerge fields and adding text to it) In this document I want to insert two tables. So far, everything works fine, no problem here. I just want to…
0
votes
1 answer

docx4j - Load part from xml file

I'm trying to create a NumberingDefinitionsPart from a number.xml extracted from another docx file. Here is what I have tried: String xml = new String( Files.readAllBytes(Paths.get(path)), Charset.defaultCharset() ); NumberingDefinitionsPart ndp =…
CDT
  • 10,165
  • 18
  • 66
  • 97
0
votes
1 answer

How to set Font size and font family in document using docx4j

FileReader fr=new FileReader("E://HtmlToDoc//LETTER.html" ); BufferedReader br=new BufferedReader(fr); while( (s=br.readLine())!= null ){ html=html+s;} html=""+html.substring(html.indexOf("")); /************************…
0
votes
1 answer

How to enforce password protection of MS-Word in Java?

I do see various options to enforce protection but none with a password. How would I do that? File file = new File(fileName); FileInputStream fis = new FileInputStream(file.getAbsolutePath()); XWPFDocument document = new…
0
votes
1 answer

attaching excel to .docx using docx4j (or any other api)

Currently I am working on a project which requires automating document generation. So far, i am successful in replacing placeholders with user-entered fields on the .docx using docx4j and also adding a .png image on the placeholder. Now, I need…
0
votes
1 answer

Convert html to word document using docx4j in java

I am converting HTML Document into word document using Docx4j jar. finally i got the word document but i could not change the default properties. I have facing the following problems in Docx4j jar How to set the custom page size of document…
0
votes
1 answer

docx4j errors when starting activity

It may be obvious but can someone help. The project compiles fine the error occurs at run-time: 12-02 06:56:36.871: I/dalvikvm(1121): Could not find method org.docx4j.openpackaging.packages.WordprocessingMLPackage.createPackage, referenced from…
Gulfaran
  • 91
  • 5