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.