I'm really happy to announce the 4th CTP for the Open XML SDK 2.0 for Microsoft Office! There were four major improvements we made to the SDK:
With the latest CTP you are able to create, edit, and consume Office generated Open XML formats for either Office 2007 or Office 2010. Looking back at the original Open XML SDK architecture diagram I showed you when we first announced the Open XML SDK, we have extended the base level layer to include Office 2010 support:
What does that mean? Well, let me show you some examples.
The Open XML Packaging API component allows you to add/remove parts within an Open XML package. This component functions by providing you strongly typed classes for every part within a package. In Office 2010 we've added new parts to the package in order to support some of our new features. With this CTP you are able to deal with these new parts with classes. For example, Word 2010 added a new part called stylesWithEffects. This part is used to help round trip styles that are based on Word's new text effects feature.
The Open XML Low Level DOM component allows you to create, edit, or consume xml contained in parts contained within an Open XML package. Like the packaging API component, this component functions by providing you with strongly typed classes for every element supported within the xml. For example, imagine we have the following text in a Word document, which uses the new text effects feature glow:
This text is represented in xml and the Open XML SDK as the following:
Open XML SDK Code
As you can see from the code snippet above, leveraging the Office 2010 Open XML functionality of the SDK is as simple as including the appropriate set of namespace references.
In a previous post I talked about how to find Open XML errors with the Open XML SDK validation functionality. In that post, I talked about finding both schema and semantic (constraints defined in the prose of the documentation that are not represented in schema markup) validation errors. With the latest SDK CTP you are now able to differentiate between errors specific to Office 2007 or Office 2010. The code to validate a file is pretty much the same as the code I showed in the previous post mentioned. The major difference is that we moved the validation functionality to be under its own namespace reference: "using DocumentFormat.OpenXml.Validation". We moved this functionality to its own namespace to improve discoverability of the feature. The OpenXmlValidator class now takes in an enumeration called FileFormatVersions that allows you to specify either Office 2007 or 2010:
The validation functionality also has the ability to automatically deal with extensibility markup, like alternate content blocks, as defined by the Open XML standard.
We recently conducted a usability study for the Open XML SDK where we asked participants to complete a set of tasks. Based on the results of the study we found that users had issues around the complexity of the Open XML SDK Open methods. In the August 2009 CTP of the SDK, each of the classes WordprocessingDocument, SpreadsheetDocument and PresentationDocument had nine overloaded Open methods. For example, let's look at the WordprocessingDocument class as an example:
Now with the latest CTP, the number of overloaded methods for Open has been reduced to six methods:
Advanced open settings are now part of a new class called OpenSettings. This class allows you to pre-process documents according to markup compatibility, auto save files, or caps the open method to deal with a specific number of characters within a part. Hopefully this change will make it easier to deal with the Open method.
The last major improvement I want to call out is around the free Open XML SDK tool that comes with the SDK. In the August 2009 CTP, the Open XML SDK shipped with three separate tools:
Based on feedback we have separated the download of the tools from the SDK dll. In other words, the Open XML SDK download page now has two download links: one for the SDK dll and one for a new consolidated Open XML SDK tool. As of the December 2009 CTP, the Open XML SDK tools are consolidated into one tool. In addition we've added some new functionality to the SDK. Here is a video that shows you an overview of the new tool:
The new tool adds the following functionality:
Let us know what you think of the new tool. I think of the new tool as the Open XML version of Macro Recording.
Please continue to send us your feedback, either on this blog or at our Microsoft Connect site for the Open XML SDK. We look forward to hearing from you.