在 MS Word 中以编程方式打开 xml 文件
我正在使用 C# 在 Microsoft Word 2007 中打开一个 xml 文件。 我使用 xsl 文件来定义布局,直到我需要包含图像为止。 我使用了典型的 src html 标签,并且在 ie 中查看 xml 时会显示图像,但在 Word 中打开它时不会显示图像。 我得到了图像占位符,所以我只能假设 Word 根本找不到该图像。 它位于 xml 文件和 xsl 文件旁边,但这没有任何区别。 为了打开文档,我传递了 xml 和 xsl 的文件名。 我想,由于 src 位于 xsl 中,因此它看起来只是相对于这些文件之一。
任何建议将不胜感激。
[编辑] 抱歉,我忘记了这个。 我最后修好了。 明天我会检查我的解决方案并更新。
I'm opening an xml file in Microsoft Word 2007 using C#. I'm using an xsl file to define the layout which worked up to the point that I needed to include an image. I used the typical src html tag and the image displays when the xml is viewed in ie but not when it's opened in Word. I get the image place holder so I can only assume Word simply can't find the image. It's sitting next to both the xml file and xsl file but that doesn't make any difference. To open the document I'm passing the filenames for both the xml and xsl. I would imagine that as the src is in the xsl it would just look relative to one of these files.
Any suggestions would be much appreciated.
[EDIT] Apologies I lost track of this one. I fixed it in the end. I'll check what my solution was tomorrow and update this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您需要指定文档的工作路径以指向基本位置。 像这样的东西: wordDocument.Path = xml 文件路径(或该图像假定为基础的任何路径)
I think you need to specify the working path for the document to point at the base location. Something like this: wordDocument.Path = xml file path (or whatever that image assumes to be the base)