开发者

How to use Freemarker to convert a XML Word document to a DOC?

开发者 https://www.devze.com 2023-04-12 22:36 出处:网络
I\'m trying to use Freemarker to convert an XML Word document to a stan开发者_开发问答dard DOC. For example:

I'm trying to use Freemarker to convert an XML Word document to a stan开发者_开发问答dard DOC. For example:

  1. I generate a Word document (A.doc) and then save it as XML Word document (A.xml).
  2. On Freemarker, I import A.xml and export it as 2003 Word (B.doc).
  3. In POI, I import the converted DOC (B.doc). (POI can't read XML docs.)

The problem is: the converted document isn't really a DOC, it's an XML doc,

so POI fails to open it.

How to use Freemarker generate a real DOC, not a XML word document?

I'm using Linux.


Your approach probably won't work because FreeMarker is designed for generating text output. Classic Word DOC files are not very "textual", so I think FreeMarker is not the right tool for your task.

(Side note: but RTF might work)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号