views:

59

answers:

1

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:

Powerpoint error

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.

+3  A: 

For basic validation of Open XML documents, you can use the Open XML SDK. See these two links as a start:

For non-SDK validation, it is done mostly by hand. Most errors in PowerPoint relate to:

  1. Mismatch between slide layout and master slide layout. <- this one is more common when writing to different templates.
  2. Relationship Ids (rId) don't match.
  3. Incorrect entries in [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.

Otaku
thanks for your input, but I can't really mark this as the answer because my original question states that I can't use the SDK. This is because I don't have access to a recent enough .NET compiler.I quick glance at your first link looks like achieving the same result as simply validating the XML against the schemas that I'm already doing using the MSXML COM library.
thegravytalker
There are no automated validation tools, that I know of, outside of the SDK. For any validation not using the SDK, it will have to be done manually, as mentioned in the comments. That will require stepping through the code that is produced to ensure it is valid XML in the context of where it is inserted/deleted/edited.
Otaku
@Otaku yes, I agree with you on this. Stepping through each change I'm making is probably the only option but that's also a general programming solution. I was hoping for a specific Office XML tool for PowerPoint that would actually point me in the direction of the error instead of PowerPoint just saying "there's an error" when it loads the presentation. It's odd that Word 2007 goes a bit further to report what's wrong and PowerPoint doesn't.
thegravytalker
None exist, as far as I know, outside of the SDK. But there are some techniques. I've listed above.
Otaku