How to convert xsl-fo to docx (Office Open XML) in Java?

大城市里の小女人 提交于 2019-12-06 12:29:48

问题


I'm looking for an open-source or commercial friendly library in Java to convert xsl-fo to docx (Office Open XML) format.

I'm planing to use xsl-fo to produce pdf documents (with Apache FOP), so I thought generating Word documents (docx) out of the same source XML could be a good idea.

UPDATE: I forgot to mention that I'm using Java.


回答1:


Alternatively, you could do: your source xml -> docx -> xsl-fo -> pdf.

or easier perhaps: source xml -> Flat OPC XML -> xsl-fo -> pdf.

Once you have a docx (or a Flat OPC XML document), transforming that to PDF via FOP is easy with docx4j (since you mention FOP, I'm assuming Java is ok for you).

The benefit of this approach is that you style your output docx as desired, and get the xsl fo "for free".

Flat OPC XML is convenient, because it is docx as a single XML file (ie no need to unzip). So you can create it easily via XSLT. To see it, create a document in Word 2007, and choose "save as .. xml".



来源:https://stackoverflow.com/questions/4372043/how-to-convert-xsl-fo-to-docx-office-open-xml-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!