I am adding dynamic XHTML contents to existing docx template by the following the way as described below,
- Code: Select all
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
MainDocumentPart mdp = wordMLPackage.getMainDocumentPart();
mdp.addParagraphOfText("Paragraph 1");
// Add the XHTML altChunk
String xhtml = "my xhtml goes here";
mdp.addAltChunk(AltChunkType.Xhtml, xhtml.getBytes());
mdp.addParagraphOfText("Paragraph 3");
// Round trip
mdp = mdp.convertAltChunks();
What i dont understand is the purpose of calling mdp.convertAltChunks();
While i use this , i am getting error in log ...