Page 1 of 1

Unable to open created docx file

PostPosted: Wed Jul 10, 2013 1:16 am
by docx4jNovice
I am creating a docx file using docx4j 2.8.1 and I read some fields from Oracle DB and write it into my file. Some of these fields has data which was saved with different formats like bullets,links,special characters etc. Although the file gets created successfully, when I try to open the file I get the error
'The file cannot be opened because there are problems with the contents. Details : Illegal xml character
Location : Part:/word/document.xml, Line:1, Column: 1771'

Java code is as follows:
mainDocumentPart.addStyledParagraphOfText("Heading2", "Title: " + database_field_value);

Do I need to process the database_field_value before adding it to the document part? It seems that although the value is getting written into the file , it is not being read properly when the file is opened.

I am unable to figure out the issue.I am new to docx4j and any help is appreciated.

Re: Unable to open created docx file

PostPosted: Wed Jul 10, 2013 7:40 am
by jason
docx4jNovice wrote:'The file cannot be opened because there are problems with the contents. Details : Illegal xml character
Location : Part:/word/document.xml, Line:1, Column: 1771'


Please unzip the docx, extract word/document.xml, and paste the content from say col 1600 to 1900.