更正 Powerpoint 2007 XML 错误
我目前正在编写一个过程,该过程可以通过 VBScript 使用 MSXML 库从给定模板以编程方式生成 Powerpoint 报告。我对 XML 所做的唯一操作是复制幻灯片、将数据插入到图表的 Excel 数据表中以及一些标题文本文本替换。我正在测试两个模板,它们的图表相同,但样式和布局不同。其中一个模板为我提供了一个工作输出 pptx 文件,而另一个模板在打开时显示此错误:
现在我想知道找到此错误原因的最佳/最简单方法是什么?我尝试过比较模板、输出和 Powerpoint 的校正输出之间的 XML,但差异出现在许多不同文件的许多不同位置,因此这是一个非常漫长的过程。有没有任何检查/验证工具可以帮助我?我已根据架构检查了 XML,但 XML 似乎是有效的。
我无法升级到 Microsoft 的 OpenXML SDK for .NET 等工具,并且该流程必须在我当前使用的 VBScript/MSXML 流程中实现。
I'm currently writing a process that generates Powerpoint reports programmatically from a given template using the MSXML library via VBScript. The only manipulation of the XML I'm doing is to duplicate slides, insert data into the Excel datatables for charts and a couple of title-text text replacements. I'm testing on 2 templates which are identical in terms of the charts but differ on the styles and layouts. One of the templates gives me a working output pptx file whereas the other shows this error when opened:
Now what I want to know is what's the best/easiest way of finding the cause of this error? I've tried diffing the XML between the template, output and Powerpoint's corrected output but differences appear in so many different places in so many different files that it's a very lengthy process. Are there any checking/validation tools that could help me here? I've checked the XML against the schemas but the XML seems to be valid.
I can't upgrade to tools such as Microsoft's OpenXML SDK for .NET and the process must be implemented in the VBScript/MSXML process I'm currently using.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 Open XML 文档的基本验证,您可以使用 Open XML SDK。请从以下两个链接开始:
使用中的验证工具
Open XML 格式 SDK
XML SDK 验证
对于非 SDK 验证,主要是手动完成的。 PowerPoint 中的大多数错误与以下内容有关:
主幻灯片布局。 <-这个是
写信时更常见
不同的模板。
rId
) 不匹配。
[内容类型].xml。
一种技术是在无效的幻灯片平台上选择“修复”,然后用不同的名称保存修复的幻灯片。然后,您可以使用 DiffOPC 工具来运行已修复的工具和有错误的工具来尝试确定修复的内容 - 这通常可以很好地表明最初的问题是什么。
For basic validation of Open XML documents, you can use the Open XML SDK. See these two links as a start:
Using the Validation Tools in the
Open XML Format SDK
XML SDK Validation
For non-SDK validation, it is done mostly by hand. Most errors in PowerPoint relate to:
master slide layout. <- this one is
more common when writing to
different templates.
rId
) don'tmatch.
[Content_Types].xml.
One technique is to choose "Repair" on the invalid slide deck and then save the repaired deck with a different name. You can then use the DiffOPC tool to run against the repaired one and the one with errors to try to determine what was repaired - that will usually be a great indication of what was incorrect in the first place.