931
questions
22
votes
4
answers
35k
views
Apache POI or docx4j for dealing with docx documents [closed]
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 ?
19
votes
7
answers
37k
views
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'. > ...
10
votes
3
answers
7k
views
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 ...
10
votes
1
answer
5k
views
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();
//...
9
votes
1
answer
11k
views
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 ...
8
votes
3
answers
29k
views
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....
7
votes
2
answers
22k
views
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 ...
7
votes
3
answers
19k
views
"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 "</img>". Exception Error in Docx4JException'
...
7
votes
1
answer
20k
views
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 ...
6
votes
2
answers
16k
views
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) {
...
6
votes
1
answer
14k
views
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:
<...
6
votes
3
answers
7k
views
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.
...
6
votes
1
answer
3k
views
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 ...
6
votes
2
answers
4k
views
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....
5
votes
5
answers
59k
views
Reading .docx file in java
I am trying to read one file in java, following is the code :
public void readFile(String fileName){
try {
BufferedReader reader= new BufferedReader(new FileReader(fileName));
...
5
votes
1
answer
10k
views
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 ...
5
votes
2
answers
9k
views
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 ...
5
votes
6
answers
6k
views
Cannot use docx4j inside of JBoss 7
I was able to successfully create a simple project with docx4j ( http://www.docx4java.org ). This simple project successfully created and wrote on a .docx document. Now I am trying to accomplish the ...
5
votes
2
answers
12k
views
How to apply new line in docx file generation using DOCX4J
By the tutorials that I have seen. I learned how to add text on generating a docx file. but then Every time I add a line of text. I noticed that there is always a space between the first line of text ...
5
votes
3
answers
8k
views
Save WordprocessingMLPackage to ByteArrayInputStream
How can I save a org.docx4j.openpackaging.packages.WordprocessingMLPackage instance into ByteArrayInputStream, then It can be downloaded from server.
Thanks.
5
votes
3
answers
10k
views
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, ...
5
votes
3
answers
5k
views
docx4j create unnumbered / bullet list
I would like to create an unnumbered list with bullets using docx4j in my Word document. I have found the following code that is supposed to do the work. But whatever I try, the generated list is a ...
5
votes
2
answers
3k
views
How to add merge field in word with docx4j?
I am able to add text and paragraphs to word and also replace any merge fields with text but I need to add a new merge field using docx4j to create a word template. How can I do this?
Do I use ...
5
votes
2
answers
5k
views
ClassNotFoundException: org.docx4j.openpackaging.exceptions.Docx4JException
So here we go again. My head is banging on my PC about few hours, I can't figured out what to do. On my local PC I run the java code from Intellij Idea. It works. Now I have to create jar file to make ...
5
votes
2
answers
1k
views
docx4j XHTMLImporter ignores   (non-breaking space)
The XHTMLImporter from docx4j is not converting   into MS WORD non-breaking spaces.
Following code is used:
public void convert() throws Exception {
String stringFromFile = FileUtils....
5
votes
1
answer
462
views
Convert html + css (print media) to msword in java
Here is my situation. I have an html/css (css contains print media properties such as @page, @bottom-center etc) resource which is converted to pdf via flying-saucer just fine.
Now, I need to convert ...
5
votes
1
answer
5k
views
Apache FOP returns "The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table"
I'm running a FO file through FOP, and getting an error message below:
WARNING: The following feature isn't implemented by Apache FOP, yet: table-layou
t="auto" (on fo:table) (See position 2:753)
May ...
4
votes
4
answers
20k
views
docx4j find and replace
I have docx document with some placeholders. Now I should replace them with other content and save new docx document. I started with docx4j and found this method:
public static List<Object> ...
4
votes
1
answer
2k
views
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()....
4
votes
1
answer
8k
views
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 ...
4
votes
1
answer
8k
views
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 ...
4
votes
1
answer
3k
views
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 ...
4
votes
1
answer
3k
views
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 ...
4
votes
1
answer
498
views
Docx4j library in Lucee 5.0
Background
Docx4j is a Java library which can be used to work with Microsoft Word documents as XML in Java. Our older application, which is written in Coldfusion, already uses this library correctly. ...
4
votes
1
answer
22k
views
how to convert HTML to .docx using docx4j? [closed]
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.
...
4
votes
1
answer
4k
views
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 ...
4
votes
2
answers
4k
views
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 ...
4
votes
1
answer
3k
views
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 ...
4
votes
3
answers
7k
views
Convert docX to a custom XML
I have been trying to convert my docX files to a XML I have custom-made. My users want their data converted to this XML for easier content query in their web app and they want the input to be from ...
4
votes
1
answer
3k
views
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 ...
4
votes
2
answers
3k
views
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:
...
4
votes
2
answers
6k
views
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 ...
4
votes
1
answer
900
views
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) ...
4
votes
1
answer
2k
views
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 ...
4
votes
1
answer
228
views
Duplicating multiple powerpoint slides using docx4j
I'm trying to duplicate a couple slides using docx4j but I am running into some trouble.
I have a .pptx file with 3 pages and I am looking to duplicate each page several times. This is my code so far ...
4
votes
1
answer
3k
views
Error generating pdf from docx with POI
I want convert a docx to pdf with apache poi, the docx is generated correctly with docx4j. The conversion work fine with simple document, but when I want to convert a more stylized document, POI ...
4
votes
1
answer
5k
views
Rejecting re-init on previously-failed class java.lang.Class<library.package.class> on Android Lollipop
I am trying to generate PDF/Docx in android.
I tried with a lot of libraries: apache poi, docx4j and pdf box but always have this message in the console.
Any idea?
For example for this example code ...
3
votes
1
answer
3k
views
Docx4j missing borders of table after adding
I´ve got a problem while creating a table. Heres my code:
Tbl projectTable = TblFactory.createTable(rows, cols, cellWidthTwips);
Tr tr = (Tr) projectTable.getContent().get(0);
Tc tc = (Tc) tr....
3
votes
3
answers
6k
views
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 ...
3
votes
3
answers
13k
views
I am using docx4j for reading .docx files and I need to get the paragraph of a document and replace strings
I am using docx4j for reading and parsing .docx files but when I iterate through paragraphs it is reading in one pass not all of the paragraph. Below is a sample of the code I am using.
private void ...