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 , as
27.June.2013 13:01:38 39246 ERROR [SwingWorker-pool-406181968-thread-1] org.docx4j.model.properties.PropertyFactory (createPropertyFromCssName:545) - What to do for text-decoration:none
27.June.2013 13:01:38 39246 ERROR [SwingWorker-pool-406181968-thread-1] org.docx4j.model.properties.Property (<init>:70) - No support for unit 1
but the conversion works even without the call to convertAltChunks & then the above error disappears. So i am little bit confused , do i really needs to call this ?
Thanks ,
Sreejith