douchen2011
douchen2011
2012-04-13 09:02

Word XML到HTML(带样式)

已采纳

I have a word template (msword 2010) that I inject variables into using PHPWord, and would like to convert that into a PDF.

My thought process is to convert the word document into xml (which I have done), then turn that xml into styled html.

So far I have managed to replace the xml elements that represent line breaks and paragraphs, but am wondering if there is some code somewhere that will convert the other xml elements into styled html. I know it is unlikely to be perfect, but something close would be good.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dongye9182 dongye9182 9年前

    Your best bet is to use XSLT. There are some good tutorials on the web. This page gives the code for doing this in PHP.

    点赞 评论 复制链接分享