XSLT解析XML生成Word文档
我有一个 XLST 文件,该文件应该解析 XML 文件并生成 Word 文档。但是当我在 Visual Studio 中解析它时,它会生成另一个 XML,因为它的标头是:
<xsl:output method="xml" omit-xml-declaration="no" version="1.0" encoding="utf-8" standalone="yes" />
<xsl:template match="/">
<xsl:processing-instruction name="mso-application">
<xsl:text>progid="Word.Document"</xsl:text>
</xsl:processing-instruction>
我尝试了 method=“text”,但它生成了一个没有格式的纯文本。 我应该指定什么属性,以便在运行转换时将结果保存在 Word 文档中?
I have an XLST file that is supposed to parse an XML file and generate Word document. But when I parse it in Visual Studio it produces another XML because its header is:
<xsl:output method="xml" omit-xml-declaration="no" version="1.0" encoding="utf-8" standalone="yes" />
<xsl:template match="/">
<xsl:processing-instruction name="mso-application">
<xsl:text>progid="Word.Document"</xsl:text>
</xsl:processing-instruction>
I tried the method= "text" but it generates a plain text with no formatting.
what property should I specify so that when I run the transformation it saves the result in a Word document?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
另一种选择可能是简单地生成 HTML(并将输出方法指定为 HTML)并使用 .doc 扩展名保存文件。
MS Word 将打开该文件而不会发出任何抱怨(尽管它仍然知道这是一个网页)
Another option might be to simply generate HTML (and specify the output method as HTML) and save the file with a .doc extension.
MS Word will open the file without complaining (though it still knows that it's a web page)