从 HTML 转换为 WordprocessingML
我有一个富文本框,将其数据保存为 HTML。基本上只是段落标签和简单的格式。我需要将此文本(带格式)粘贴到我以 wordprocessingML 格式创建的文档中。我正在考虑使用 XSLT 进行转换,但这就是我所能想到的。快速谷歌搜索并没有以示例或我不必购买的免费内容的形式出现太多。
有什么想法吗?
I have a rich textbox that saves its data as HTML. Basically just paragraph tags and simple formatting. I need to stick this text (with formatting) into a document that I am creating in wordprocessingML format. I was thinking of using an XSLT to convert, but that's about as far as I've got. Quick google search isn't turning up too much in the form of examples or something free that I don't have to buy.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我今天在谷歌搜索html to wordprocessingml时发现了你的问题。第二个点击是 使用 XSLT 将 HTML 表转换为 WordProcessingML,这应该可以帮助您走上正确的道路。我仍然没有找到一个功能齐全的样式表来处理多种类型的元素。
另一种方法是在文章“使用 HTML 和 CSS 动态生成 MS Word 文档”中找到的方法”。这种方法只在 HTML 中添加很少的内容(一些 XML 命名空间、针对 Outlook 2007 的条件注释(?!)以及专有和有效的 CSS 样式的组合),并且通过较少的处理产生类似的结果。但是,我在查找相关文档时遇到了麻烦。样式实体(例如
mso-header-margin
)似乎可以追溯到 Office 2000。文档(真的是 Microsoft,一个解压 CHM 的可执行文件?你不应该有!)这些实体已经过时了,但它在 Word 2007 中似乎仍然对我有用。I found your question when searching google for html to wordprocessingml today. The second hit was Converting an HTML table to WordProcessingML with XSLT, which should get you started on the right path. I still haven't found a full featured stylesheet that will handle multiple types of elements.
Another approach is the one found in the article "Dynamically generate a MS Word document using HTML & CSS". This approach adds very little to the HTML (some XML namespaces, a conditional comment targeting Outlook 2007 (?!) and a mix of proprietary and valid CSS styling) and procduces similar results with less processing. However, I've had trouble locating documentation on it. The styled entities (
mso-header-margin
, for example) seem to date back to Office 2000. The documentation (really Microsoft, an executable that unpacks a CHM? You shouldn't have!) on these entities is dated, but it still seems to work for me in Word 2007.