Is there a library capable of generating XSL-FO from Office XML documents like DOCX, XLSX?
Does anyone know of a library that is capable of generating XSL-FO from a Microsoft Office Open XML file, such as a Word DOCX or an Excel XLSX?
Given 开发者_运维知识库that these Office files are basically XML in a ZIP file, I figure it would be pretty straightforward to generate XSL-FO from them by applying appropriate XSLT transformations — though writing the XSLT would take some time. But if it is a straightforward as I suspect, then maybe someone has written a library that does it, or released XSLT transformations that do it.
This Microsoft MSDN library article contains an example of creating XSL-FO with Word 2003 WordprocessingML files, but I haven't seen anything for the newer Open XML format.
Does anyone have suggestions? A Java library would be preferable, but anything would be considered.
docx4j has support for this, for docx; since v3.3.0 it is in a separate project https://github.com/plutext/docx4j-export-FO
It uses XSLT to create the XSL-FO. The XSLT uses Java extension functions to invoke docx4j methods to do much of the work, keeping the XSLT itself relatively simple.
docx4j uses FOP to convert XSL FO to PDF.
docx4j has support for xlsx, but no built in export from XLSX to XSL FO.
RenderX has a set of publicly available stylesheets that convert WordML into XSL-FO
http://www.renderx.com/tools/word2fo.html
These stylesheets were prepared by RenderX's development team and Microsoft for general use. They are used to convert documents in Microsoft's WordprocessingML XML vocabulary into documents in the W3C's XSL FO (XSLFO) vocabulary. These generic stylesheets produce XSL FO (XSLFO) suitable for RenderX XEP Engine.
精彩评论