Page 1 of 1

converting XHTML in alt-chunk to docx

PostPosted: Fri Nov 16, 2018 11:45 pm
by zluspai
Dear Jason,

I have some -generted- content which is an HTML (or XHTML) in an alt-chunk. I've tried to use the enterprise version of your library but it says just "merge.altchunk.ProcessAltChunk - TODO: How to handle altChunk: text/html".

So it seems that enterpise does not do anything special with the HTML/XHTML, but the best option is that I use the xhtmlImporterClass via the convertAltChunks() method?

My task is that .docx is a mix of .docx and such HTML/XHTML fragments and at the end I want to convert the whole thing to PDF that it should look just like in Word. Do you have any recommendation what would be the best approach?

Thanks for the info,
Zoltan Luspai

Re: converting XHTML in alt-chunk to docx

PostPosted: Sat Nov 17, 2018 9:50 am
by jason
With -ImportXHTML and Enterprise jars on your classpath, you can invoke MainDocumentPart's convertAltChunks()

This should convert both AltChunkType.Xhtml and AltChunkType.WordprocessingML

If you encounter any issues, please let me know which versions of docx4j and these jars you are using