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

Avoid carriage return in paragraph with doxc4j

I think that paragraph elements by definition creates a new line but I need to insert elements as the first element of a page not moving down existing elements. Is there another element I can use instead of paragraph? I think that only tables and…
Paco Abato
  • 3,920
  • 4
  • 31
  • 54
0
votes
1 answer

Docx4j - Replacing Word merge field with HTML content

I am trying to replace a Word merge field "test" with an HTML content : String myText = "

Hello

"; using Docx4j. String myText = "

Hello

"; try { …
Jenna SMITH
  • 75
  • 1
  • 1
  • 10
0
votes
1 answer

Docx4j Class Not Found Error

I am trying to run a tutorial from here Office Open XML. I have downloaded the Docx4j library and added it to the netbeans as a library. the code snippet is given below import org.docx4j.openpackaging.exceptions.Docx4JException; import…
CodeAngel
  • 569
  • 1
  • 11
  • 31
0
votes
1 answer

Is it possible to set accent colors for pptx4j in groovy?

I'd like to set the accent colors belonging to ST_SchemeColorVal in Groovy. Something like: STSchemeColorVal.ACCENT_1 = new Color(0,0,0) Is this possible? If yes, how?
Juliisco
  • 3
  • 3
0
votes
0 answers

Adding multiple objects to a docx document via docx4j

I manage to add an ellipse to a docx document but fail to add more than one. This is the code I use: WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(); String xmlAnchor = getXmlAnchor(607000, 288000, 1); Object…
Paco Abato
  • 3,920
  • 4
  • 31
  • 54
0
votes
1 answer

Which is the maximum valid value for relativeHeight attribute in wp:anchor tag?

I'm inserting elements in a docx document via docx4j and I want my new elements to be on front (always visible over other elements that could overlap). I think that in order to accomplish my target I have to set to the maximum value the…
Paco Abato
  • 3,920
  • 4
  • 31
  • 54
0
votes
1 answer

Ellipse added with docx4j but not displayed in document

I'm adding an ellipse to a docx document via docx4j like this: String xmlEllipse = getXmlEllipse(); Object ellipse = XmlUtils.unmarshalString(xmlEllipse); Graphic ellipseGraphic = (Graphic) ((JAXBElement)ellipse).getValue(); Anchor anchor = new…
Paco Abato
  • 3,920
  • 4
  • 31
  • 54
0
votes
1 answer

how to find end of slide height and last added element position

I am exploring pptx4j to generate slide compatible to office 2013. One of the requirement is to move the element(new row of table/ text box/ new table/ any other element) to next slide when the element added goes beyond the slide height. Is there…
Manu
  • 453
  • 2
  • 6
  • 15
0
votes
1 answer

Preprocess OpenDoPE Word file (Macro or docx4j)

I have recently discovered the OpenDoPE project. From what I understand from the walkthrough, .docx files must be preprocessed to replace repeatable contents for example. If I understand well there are 2 ways to do it : Using docx4j Using a…
Cyril Duchon-Doris
  • 12,964
  • 9
  • 77
  • 164
0
votes
0 answers

Creating a GUI to edit multiple documents

I'm working on a personal project which involves editing multiple docx files. Currently, I'm working on creating a program which will allow me to select multiple files and edit them all at once (all documents will be in the same format, so changes…
Ryan
  • 47
  • 1
  • 1
  • 6
0
votes
1 answer

How to use docxj4 in Android project

I want to run docx4j on Android. I'm downloaded this eclipse project and extract the jar that when I import into my Android project and run, the application crashed with error message: java.lang.NoClassDefFoundError: org.apache.log4j.Logger.…
0
votes
1 answer

How to specify PDF file name during conversion in Docx4J

I need to output the resulted PDF within the browser. This is what I have so far public void displayWordAsPDF(InputStream inputStream,HttpServletResponse response) throws Exception { …
abiieez
  • 3,139
  • 14
  • 57
  • 110
0
votes
0 answers

Adding header to docx file using Java and Docx4j library

I have 3 files: contentFile footerFile headerFile All of them are .docx files. Using docx4j, how can I add content of the headerFile as a header to the pages of contentFile. I have to do the same with the footerFile.
Raha
  • 1
0
votes
1 answer

xlsx4j to evaluate excel formulas

provided that xlsx4j satisfies the SpreadsheetML specs, can the following scenario/requirement be implemented using the library? xlsx4j can read named ranges xlsx4j can evaluate a formula that is defined in the spreadsheetML specs xlsx4j can…
dee dee
  • 3
  • 1
0
votes
1 answer

Add a Border and change Font Size - docx4j

I'm trying to create a document in java WordprocessingMLPackage wordPackage = WordprocessingMLPackage.createPackage(); wordPackage.getMainDocumentPart().addStyledParagraphOfText("Title","User comments"); for( ... adding comments with a line…
Emma
  • 167
  • 1
  • 9