Following some posts on this forum, I'm trying to insert XHTML into a DOCX.
I'm using the addAltChunk(ContentAccessor) method to add the XHTML to the part at a certain location. The AltCunck is wrapped by a table (and a P under the Tc) and then added to the MainDocumentPart.
I tired letting Word handle the chunk, but there seems to be an issue with it showing under a Tc (http://www.docx4java.org/forums/xhtml-import-f28/inserting-html-in-a-table-cell-t1152.html#p3965 - can anyone else confirm this?) while showing it under the document root works.
However, when using the alternative option of running convertAltChunks() in the part to convert the XHTML to the DOCX schema objects, the following error is issued:
2014-07-04 13:02:40,158 WARN org.docx4j.jaxb.JaxbValidationEventHandler: - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/wordprocessingml/2006/main", local:"altChunk"). Expected elem
2014-07-04 13:02:40,175 INFO org.docx4j.jaxb.JaxbValidationEventHandler: - continuing (with possible element/attribute loss)
And the altChunk element is consequently discarded.
The XHTML passes validation and is in fact the following:
<!DOCTYPE html><html><head><title>hmm</title></head><body>hello world</body></html>
Upgrading DOCX from 2.8.1 to 3.1 made no difference.
Using JDK 1.6.
Thought I'd ask here before perusing debugging the issue.
If anyone has any pointers, I'd really appreciate it.
Cheers,
Roded