Improvements Made to the Final Open XML SDK 2.0 compared to the December 2009 CTP

In a previous post, where I announced the release of the Open XML SDK 2.0, I promised to give you guys a list of improvements and breaking changes made to the SDK compared to the December 2009 CTP.

We made a few tweaks to the SDK based on some of the great feedback we received from you guys. The following sections below outline these changes.

Autosave for Creating Documents

One of the changes we made to the SDK is around supporting autosave for document creation. Back in August 2009 we released a CTP that included autosave functionality when modifying parts within the Open XML package. This functionality allowed for changes to be automatically saved into the package, without the need to call Save() methods. We also provided a mechanism to turn off this functionality. This functionality worked great when opening existing files. However, we never added such functionality for newly created documents. That's what we added this time around for the final version of the SDK. Here are the new Create() methods:

  • public static WordprocessingDocument Create(Package package, WordprocessingDocumentType type, bool autoSave);
  • public static WordprocessingDocument Create(Stream stream, WordprocessingDocumentType type, bool autoSave);
  • public static WordprocessingDocument Create(string path, WordprocessingDocumentType type, bool autoSave);
  • public static SpreadsheetDocument Create(Package package, SpreadsheetDocumentType type, bool autoSave);
  • public static SpreadsheetDocument Create(Stream stream, SpreadsheetDocumentType type, bool autoSave);
  • public static SpreadsheetDocument Create(string path, SpreadsheetDocumentType type, bool autoSave);
  • public static PresentationDocument Create(Package package, PresentationDocumentType type, bool autoSave);
  • public static PresentationDocument Create(Stream stream, PresentationDocumentType type, bool autoSave);
  • public static PresentationDocument Create(string path, PresentationDocumentType type, bool autoSave);

Improved Namespace Processing

The older CTPs used a predefined mapping between the XML prefixes and the different namespaces. In other words, the SDK assumed a specific prefix for a specific namespace. For example, a WordprocessingML Paragraph would always write out the element <p> with the prefix w, such as <w:p>. The issue, that some of you brought up, is that the SDK didn't handle custom prefixes defined in XML fragments if those prefixes conflicted with the predefined list of prefixes of the SDK. With the final version of the SDK we fixed this issue. The final version of the SDK should be a lot more robust.

Breaking Changes in the Final Release of the Open XML SDK 2.0

The following table outlines changes made to Open XML SDK classes and attributes where there is a difference in the December 2009 CTP vs. the final RTW version of the Open XML SDK:

December 2009 CTP Class/Attribute Name

Final RTW SDK Class/Attribute Name

DocumentFormat.OpenXml.Spreadsheet.ObjectAnchor::Z_order

DocumentFormat.OpenXml.Spreadsheet.ObjectAnchor::ZOrder

DocumentFormat.OpenXml.AdditionalCharacteristics

DocumentFormat.OpenXml.AdditionalCharacteristicsInfo

DocumentFormat.OpenXml.Wordprocessing.Alias

DocumentFormat.OpenXml.Wordprocessing.SdtAlias

DocumentFormat.OpenXml.Wordprocessing.LatentStyleException

DocumentFormat.OpenXml.Wordprocessing.LatentStyleExceptionInfo

DocumentFormat.OpenXml.Drawing.Diagrams.Else

DocumentFormat.OpenXml.Drawing.Diagrams.DiagramChooseElse

DocumentFormat.OpenXml.Drawing.Diagrams.If

DocumentFormat.OpenXml.Drawing.Diagrams.DiagramChooseIf

DocumentFormat.OpenXml.Math.Function

DocumentFormat.OpenXml.Math.MathFunction

DocumentFormat.OpenXml.Vml.Handle

DocumentFormat.OpenXml.Vml.ShapeHandle

DocumentFormat.OpenXml.Vml.Handles

DocumentFormat.OpenXml.Vml.ShapeHandles

DocumentFormat.OpenXml.Office2010.Ink.Property

DocumentFormat.OpenXml.Office2010.Ink.ContextNodeProperty

DocumentFormat.OpenXml.CustomProperties.Property

DocumentFormat.OpenXml.CustomProperties.CustumDocumentProperty

DocumentFormat.OpenXml.Spreadsheet.Set

DocumentFormat.OpenXml.Spreadsheet.TupleSet

DocumentFormat.OpenXml.VariantTypes.VTOStream

DocumentFormat.OpenXml.VariantTypes.VTOStreamData

DocumentFormat.OpenXml.VariantTypes.VTStream

DocumentFormat.OpenXml.VariantTypes.VTStreamData

DocumentFormat.OpenXml.VariantTypes.VTVStream

DocumentFormat.OpenXml.VariantTypes.VTVStreamData

DocumentFormat.OpenXml.CustomProperties.CustumDocumentProperty

DocumentFormat.OpenXml.CustomProperties.CustomDocumentProperty

Note: The change from Alias to SdtAlias will affect the most people.

Zeyad Rajabi