问题
I just tried to a docx document through docx4j's sample webapp at: http://webapp.docx4java.org/OnlineDemo/docx_to_pdf_fop.html the resulting PDF file had the tables incorrectly formatted. In fact the tables were significantly off...
I'm just wondering if it's because docx4j doesn't properly support tables or it's an error of some sort. And if so, if anyone could point me to the proper information.
回答1:
https://github.com/plutext/docx4j/blob/master/sample-docs/word/tables.docx is an example of various table features we can process.
Without seeing your docx (and absent any description in your question of the disparity!), I'd say either:
you're using some table feature we don't support yet, or
if the document is 30 pages long, or its document.xml longer than 300KB, the faster 'non XSLT' code will be used. This code doesn't have feature parity yet.
2019 Update
For some context, there are 2 main ways to do docx to PDF in the docx4j world:
- older/cheerful approach: using docx4j-export-fo (which is the XSL FO approach discussed here, and which that tables sample document is for)
- the commercial PDF Converter, which offers higher quality and performance (at a price), and has much better table support
docx4j will automatically use export-fo if the jar is on your classpath.
If you want to try the commercial PDF Converter, you need to point to an instance using https://github.com/plutext/docx4j/blob/master/src/samples/_resources/docx4j.properties#L90
来源:https://stackoverflow.com/questions/20437235/doc4j-having-issues-converting-docx-to-pdf-with-tables-in-the-document