Questions tagged [docx4j]

0

votes
0

answer
2

Views

XHTML to Docx conversion using docx4j not reading font-size style

XHTML: 18F, Mirae Asset CENTER1 West Tower converted document.xml: 18F, Mirae Asset CENTER1 West Tower font-size:8pt; not getting converted to in ooxml. If font-size is given as small,x-large,etc. it gets converted.
Sourav
1

votes
0

answer
84

Views

docx4j excel xlsx insert image on android platform

i am new to docx4j ,i have previously used apache poi to insert multiple images into excel xlsx on my Android app,due to Huge and heavy library size imposed by poi, i am looking for alternative. docx4j image inserting seemed to be much more complex than i thought after looking at the examples sampl...
1

votes
0

answer
109

Views

Remove paragraph style with docx4j

In my word template file I have some tables and sometimes the second column of them is formatted as an enumeration. Using docx4j I'm filling it with dynamic content and if there's only one entry I need to get rid of the enumeration style. I found a place deep down in the structure that has a value f...
Cold_Class
1

votes
0

answer
87

Views

Docx4J - Docx to PDF conversion - header and footer area tree calculation exception

I am trying to convert a DOCX file to PDF using FO-based PDF output with the help of Docx4J. Screenshots of DOCX file and converted PDF file are attached at the very end of question. I am encountering a problem in header/footer alignment. At the moment, what I found is the engine seems to have pro...
LJ Seng
1

votes
1

answer
104

Views

Doc4j pptx find and replace table row

I have a requirement where I need to replace some text in a Powerpoint File at runtime(Powerpoint file is being used as a template with some placeholders/tokes e.g. {{data1}} ) in one row on table. I referred to the other links on the forum and started with 'docx4j' but am not able to go beyond a p...
selva
1

votes
2

answer
196

Views

Page Number In docx4j

I am wondering how I can get page number in docx4j My issue is that I created a table and have to remove some borders between some rows but that made table with no bottom borders before page break So I need information about page number to do something like this if(currentElementPageNumber != pre...
Yuuuucef
1

votes
2

answer
80

Views

Create a DOCX reading data from Oracle database

I have a student database (Oracle 11G), I need to create a module(separate) which will generate a student's details in a well-formatted word document. When I give the student ID, I need all the info(Kind of a biodata) of the student in a docx file which is very presentable. I'm not sure how to start...
user1862271
1

votes
0

answer
52

Views

I'm converting a docx page created by Apache POI into docx4j. Adding the altChunk resets fonts on previously created page

I'm loading a simple page with a header and styling created by POI and saved it as test.docx: XWPFDocument document = new XWPFDocument(); XWPFParagraph paragraph = document.createParagraph(); XWPFRun run = paragraph.createRun(); run.setFontFamily('Arial Narrow'); run.setFontSize(22); run.setText('Te...
T Trazz
1

votes
0

answer
66

Views

How to remove the signature '## Evaluation Use only ##' in the docx4j pdf generation?

To remove the signature '## Evaluation Use only ##' from pdf generation using Docx4j. Currently how the PDF document is generated - Using Template document, docx file will be created. From the created docx file, Docx file will be converted to PDF file format. In the generated PDF file, find this si...
krishnaraj
1

votes
1

answer
52

Views

Set Custom Page size in Word Document using Docx4j

How can I create a document with custom page size using docx4j. I have searched over the net and able to find that we can create the page size available in PageSizePaper ENUM only....Please help me out to create the doc with custom page size..
Nishant Varshney
1

votes
1

answer
36

Views

How to get HEADER / FOOTER from docx using docx4j

I am trying to get the header footer from a word document and append them to a StringBuilder. I've come across some similar questions which have led me to below snippet: StringBuilder sb = new StringBuilder() RelationshipsPart rp = documentPart.getRelationshipsPart(); for ( Relationship r : rp.getJa...
Anthony
1

votes
1

answer
1.7k

Views

Convert docx/pptx to MHTML in pura java

I am struggling to convert word documents and power point presentations to convert to HTML/MHTML pages. I am able to convert docs to html using docx4j but it comes out as distorted and creates images etc as separate files (standard HTML). I have a requirement where users upload docx and pptx files a...
Sourabh Girdhar
1

votes
1

answer
1.2k

Views

MOXy XMLCompositeCollectionMapping descriptor is missing

docx4j (which I host) is typically used with the Sun/Oracle JAXB implementation; the classes of interest below were generated using XJC. I thought I'd try EclipseLink MOXy, to see how it went. On context init, I get the following error: ERROR org.docx4j.jaxb.Context . line 107 - Cannot initialize co...
JasonPlutext
1

votes
1

answer
482

Views

HeadlessException using docx4j xhtmlrenderer on RedHat server

I'm getting a java.awt.HeadlessException when using a Docx4jReplacedElementFactory on a RedHat server. Does anyone know of a workaround for this? (other than running Xvfb) I've drilled in to the stack trace and the source of the problem is java.awt.GraphicsEnvironment.getDefaultScreenDevice(), which...
David Carboni
1

votes
2

answer
4.3k

Views

When using docx4j in android to read word doc facing the following issue

Aim: To read content of a word doc onto the cosole Environment used: Windows 7 32bit Eclipse IDE Indigo Android 4.1 API 16 Java 1.6 Library : docx4j-2.8.0 Following is the code snippet i am using to print text of word doc on console WordprocessingMLPackage wordMLPackage = WordprocessingMLPac...
Sai.kumar19
1

votes
2

answer
1.4k

Views

Best practice generating word and powerpoint documents using Java

I have a word document in the format of a docx, created in Word 2007. I need to open this document and at certain places in the document add Text, Images and tables. I also need to do the same thing with a Powerpoint. I've seen solutions when googling where they used strings in the document and sea...
heldt
1

votes
1

answer
631

Views

MOXy marshalling wrong object

I'm trying to have docx4j support MOXy as its JAXB implementation. We're pretty much there; see docx4j and MOXy The problem I'm having is that I have a class: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(namespace = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main', name = 'CT_Text'...
JasonPlutext
1

votes
1

answer
1.9k

Views

docx file generation using docx4j-java

I am generating a docx file with dynamic data in it using docx4j. The sample docx file is retrieved from database. Now i need to modify the dynamic data in the document. I am using an xstream to generate the xml with dynamic data. Could anyone tell me how to map this xml to the content controls us...
aml
1

votes
1

answer
1.6k

Views

Replace text with an image docx4j

I have an word template. There is an word photo that has to be replaced with an image. This has to be done with Docx4Java. How do I do this?
Ocirina
1

votes
1

answer
839

Views

docx4j html export with list

I have a problem with exporting a docx document to html with docx4j. My application cuts paragraphs out from several documents, then concatenates it into a single one, then exports it into html. The problem is with the lists. The generated docx opens and the content I want is there (although it stat...
omniflash
1

votes
1

answer
2.3k

Views

count the number of pages in a docx-document

I got a word file and I want to count how many pages are in it. The file has been created with Docx4Java. Anyone did this before? Thanks!
gert789
1

votes
1

answer
1.3k

Views

How to replace text in content control after, XML binding using docx4j

I am using docx4j 2.8.1 with Content Controls in my .docx file. I can replace the CustomXML part by injecting my own XML and then calling BindingHandler.applyBindings after supplying the input XML. I can add a token in my XML such as ¶ then I would like to replace that token in the MainDocumentPart...
MikeM
1

votes
1

answer
1.9k

Views

docx4j inside JBoss NoClassDefFoundError

I get following error when executing on jboss : WordprocessingMLPackage template = WordprocessingMLPackage .load(new FileInputStream(new File(name))); Java version: 1.7.0_25 JBoss version: 7.1.1.Final docx4j version: 2.8.1 Error: java.lang.NoClassDefFoundError: Could not initialize class org.docx...
leostiw
1

votes
1

answer
5.7k

Views

How to replace text/Merge field in Ms word with docx4j

I am trying to replace text or merge field from word document. I found out that I could use docx4j for this purpose. String docxFile = 'C:/Users/admin/Desktop/HelloWorld.docx'; WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage .load(new java.io.File(docxFile)); HashMap mappings = new...
Sujal
1

votes
1

answer
789

Views

Docx4j: Get stylename of paragraph

I want to parse a docx document. I use this code to get the paragraphs and display the text: final String XPATH_TO_SELECT_TEXT_NODES = '//w:p'; final List jaxbNodes = documentPart.getJAXBNodesViaXPath(XPATH_TO_SELECT_TEXT_NODES, true); for (Object jaxbNode : jaxbNodes){ final String paragraphString...
Iceman
1

votes
3

answer
2.4k

Views

Create docx using docx4j with multiple headers

Is it possible to create new header for every different sections using docx4j? I've seen that MS Word provides functionality to create different headers by creating different sections using section breaks. But I want to implement this functionality using docx4j. For example: If I've to create a doc...
1

votes
1

answer
3k

Views

Convert docx part to html using docx4j

I have an application trying pull some data from database and then saved it in a docx file. Some part of this data is html code, so using docx4j I was able to convert the html code into docx format. A related post was here. Now I want to convert this part text (in a table cell within a docx file ) b...
David Z.
1

votes
1

answer
1.2k

Views

Inserting an image to a particular position in a word document using docx4j

I want to add an image to particular position in my word document using docx4j. I don't want inline insertion. The code below performs adding the image inline with text. But I want floating insertion where I can explicitly give the location of where the image should be placed in the page. Please he...
Meeran Mohideen
1

votes
1

answer
674

Views

JAXB peformance issue with WebLogic 12.1.2's EclipseLink.jar

When generating a several hundred page docx document file w/ embedded images using docx4j on WebLogic 12.1.2, the performance is about 5 times slower than the same operation on WebLogic 12.1.3 running on the same virtual machine w/ the same JVM configuration -- about 20 minutes on 12.1.2 vs. 4 minut...
jlpp
1

votes
3

answer
1.4k

Views

How to remove a line with a particular content in docx4j

I want to delete a particular line in the docx if it has a particular word, say 'killer'. How i can write a program using docx4j? If i replace it with empty data, the line will be still there. I want to remove the whole line. I tried something like this, private void replacePlaceholders(Wordprocessi...
Beginner
1

votes
1

answer
353

Views

docx4j convert w:numPr convert to <ul>?

Does docx4j conversion to html support converting w:numPr elements to an html list? Attempting to have roundtrip html->docx->html. Experiencing a problem on the return from docx->html - the w:numPr become p and not converted back to the original ul. For testing, I created a new docx, added a bulle...
Morgan Dowell
1

votes
1

answer
275

Views

Find the owning Part of a node element with docx4j

I've got a list of placeholders in my DOCX document I've referenced this way : private void findPlaceHolders() { Docx4JPlaceHolderFinder finder = new Docx4JPlaceHolderFinder(); TraversalUtil.visit(document, false, finder); placeHoldersRegister = new HashMap(finder.getFoundPlaceHolders()); } Docx4JPl...
Thomn
1

votes
2

answer
266

Views

export to PDF table columns not wrapped

I created very simple test which contains table with 2 columns. One column contains long line without spaces and second columns small line. In doc I see that line from the first line is wrapped And I convert this document to PDF using Sample example service Result is the same - line from first colu...
sasha
1

votes
2

answer
1.6k

Views

Docx (or doc) generation from jsp

First, sorry if my english isn't really good :s I look for a solution to generate a word version of a jsp page. I tested many solutions but none seems to work correctly. The one who gave me the better result was to use the MIME for Word : But this solution works for IE only and forces the opening o...
WilliamN
1

votes
1

answer
169

Views

docx4j move around paragraphs

Assume a document in docx4j: Headline1 Headline2 blebleble Headline3 subtext All the headlines are paragraphs, how can I move headline 2 and all of it's subcontents to be in front of Headline1?
user2147674
1

votes
1

answer
342

Views

Is there a way to use docx4j library to convert doc format documents?

I want to read doc format using docx4j. wondering if there's away or a workaround
becks
1

votes
1

answer
113

Views

Where can I get a Font-family to language pair map for Microsoft Word

I am programmatically generating a MSWord 2011 bilingual file(contains text from 2 languages) using docx4j. My plan is to set the font-family of text based on the language in the text. eg: When I have a Latin and Indian language passed, all text containing English will have 'Times New Roman' and Hin...
Chinmay
1

votes
1

answer
1.1k

Views

Random error with OpenSAML XML Parser Configuration

I'm running a webapp in Tomcat 8 that uses OpenSAML. I've endorsed Xerces within Tomcat, I've checked that the endorsed dir path is set right, it appears that everything is working fine: [ajp-apr-8009-exec-22] DEBUG org.opensaml.xml.Configuration - VM using JAXP parser org.apache.xerces.jaxp.Docume...
jfhfmn
1

votes
1

answer
1.2k

Views

How to handle special characters when converting from HTML to DocX

I have a application that converts html files to DocX using DocX4J. I´m having problems with special characters like ç,á,é,í,ã,etc. My text font in the html files is Arial but when I convert them to DocX the special characters mentioned before are set to calibri font. So, in the same word (e.g...
Cláudio
1

votes
1

answer
1.2k

Views

docx4j Couldn't get [Content_Types].xml from ZipFile

I have been googling and trying various things such as placing a jaxb.properties file into my web2 folder to specify eclipselink but not having any luck at all. I can run from eclipse simple code String inputfilepath = 'mywordfile.docx'; WordprocessingMLPackage wordMLPackage = WordprocessingMLPackag...
Greg C

View additional questions