- Code: Select all
WordprocessingMLPackage wordMLPackage =
WordprocessingMLPackage .load(new java.io.File("e://dev//java2word//word2java//ADL.docx"));
MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
String xpath = "//w:r[w:t[contains(text(),'auditFindings')]]";
List<Object> list = documentPart.getJAXBNodesViaXPath(xpath, true);
for(Object obj : list){
List<Object> objContent=((R)obj).getContent();
objContent.clear();
objContent.add(getAuditFinding());
objContent.add(getFindingText());
}
wordMLPackage.save(new File("e://dev//java2word//word2java//ADL-new-2.docx"));
I open the ADL-new-2.docx it shows the new content , when I open in openoffice it does not show the new content also I created a pdf
- Code: Select all
WordprocessingMLPackage wordMLPackage =
WordprocessingMLPackage .load(new java.io.File("e://dev//java2word//word2java//ADL-new-2.docx"));
Mapper fontMapper = new IdentityPlusMapper();
wordMLPackage.setFontMapper(fontMapper);
org.docx4j.convert.out.pdf.PdfConversion c= new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);
OutputStream os = new java.io.FileOutputStream("e://dev//java2word//word2java//ADL-new-3.pdf");
c.output(os, new PdfSettings() );
in the generated pdf new content is not showing up , please help me.