将WordXml转换为HTML [英] Converting WordXml to HTML
本文介绍了将WordXml转换为HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想以编程方式使用C#将WordXML文件转换为HTML文件(免费开源)?注意:不应该使用转换器
I want convert a WordXML file to HTML file using C# programmatically(free open source) ? Note:converter shouldn''t be used
推荐答案
可以使用XSLT将XML文件转换为HTML.由于这种行为,可以将Word文件保存/读取/转换为xml/html/...文件.
请看一下:
生成Word报告/文档 [
Hi,
XML-Files can be transformed to HTML using XSLT. Because of this behavior it''s possible to save/read/transform word files to xml/html/... files.
Please have a look at this:
Generating Word Reports / Documents[^]
Code-Snippet for transformation:
XslTransform xslt = new XslTransform();
xslt.Load("XSLTemplate.xsl");
XPathDocument xDoc = new XPathDocument("Books.xml");
XmlTextWriter writer = new XmlTextWriter("Books.html", null);
xslt.Transform(xDoc, null, writer, new XmlUrlResolver());
writer.Close();
StreamReader stream = new StreamReader("Books.html");
Console.Write(stream.ReadToEnd());
此致
Best Regards
这篇关于将WordXml转换为HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文