Jaa


Announcing the Open XML Format SDK 1.0

We have great news for all Open XML developers who have waited so patiently for the fully supported release of the Open XML Format SDK 1.0. Today we published the final bits and online documentation on MSDN. You can get the SDK from the following locations:

What is the Open XML Format SDK?

I talked about this before in previous blog entries, but for those of you who are not familiar with this SDK, here's a brief intro.

The Open XML Format SDK Technology Preview simplifies the task of manipulating Open XML packages. The Open XML Application Programming Interface (API) encapsulates many common tasks that developers perform on Open XML packages, so you can perform complex operations with just a few lines of code. Using this API, you can programmatically generate and manipulate Word 2007 documents, Excel 2007 spreadsheets, and PowerPoint 2007 presentations. The programming model uses managed code, so it's safe for server-side scenarios.

The Open XML Format SDK also provides how-to articles and reference documentation that can help you get started with Open XML programming.

What's New in the Open XML Format SDK 1.0

The Open XML Format SDK 1.0 contains the changes described below:

  1. Renames the Microsoft.Office.DocumentFormat.OpenXml dll to DocumentFormat.OpenXml

  2. Renames the Microsoft.Office.DocumentFormat.OpenXml.Packaging namespace to DocumentFormat.OpenXml.Packaging

  3. Renames the Microsoft.Office.DocumentFormat.OpenXml namespace to DocumentFormat.OpenXml

  4. Adds support for validating by using the XmlSchemaSet object

If you have written code using previous CTP releases, keep in mind that the first three are breaking changes. You need to delete the current reference to the Microsoft.Office.DocumentFormat.OpenXml.dll and replace it with DocumentFormat.OpenXml.dll. Also, you need to change the namespace references to DocumentFormat.OpenXml.Packaging and DocumentFormat.OpenXml.

The last change has to do with a common ask from developers. Previous releases of the CTP allowed you to validate the contents of a part in an Open XML Package against a single schema file. However, it was not possible to validate against a collection of schemas. The Open XML Format SDK 1.0 provides an overloaded method of the ValidateXml method that allows you to validate a document part against a specific XmlSchemaSet object. The following sample code shows you how to validate the XML content of the MainDocumentPart part of a WordprocessingDocument package by calling the ValidateXml method of MainDocumentPart part. You pass a list of schemas to the ValidateXml method as an input parameter.

  

' Visual Basic
' How to validate the contents of a document part against
' a collection of schemas.
Public Shared Sub ValidDocumentContent(document As String,
schemaList As List (Of String))
   Dim schemas As New XmlSchemaSet()
   For Each schemaUri As String In schemaList
schemas.Add(Nothing, schemaUri)
   Next schemaUri
Using wordDoc As WordprocessingDocument =
                    WordprocessingDocument.Open(document, False)
wordDoc.MainDocumentPart.ValidateXml(schemas, Nothing)
   End Using
End Sub

// C#
// How to validate the contents of a document part against
// a collection of schemas.
public static void ValidDocumentContent(string document,
List<string> schemaList) {
XmlSchemaSet schemas = new XmlSchemaSet();
foreach (string schemaUri in schemaList) {
schemas.Add(null, schemaUri);
   }
   using (WordprocessingDocument wordDoc =
          WordprocessingDocument.Open(document, false)) {
wordDoc.MainDocumentPart.ValidateXml(schemas, null);
   }
}

Some additional improvements...

While looking at the class diagram, I noticed that the latest version includes support for a new MailMergeRecipientDataPart. You can find detailed info about this new part here. Some other minor object model changes are documented at the readme.htm file of the download.

Finally, we significantly improved the comments/descriptions of all the members included in the class reference documentation and Intellisense file. It's easier to learn how to use an API when the comments and member descriptions are in good shape.

Roadmap and Development Timeline

The Open XML API Version 1.0 is included with the Open XML Format SDK 1.0 and only contains the Open XML Packaging API. Open XML API Version 2.0 releases should contain all of the Open XML API components, including the Open XML Packaging API with further updates. In the next months, the Open XML Format SDK product team will be releasing CTPs of the Open XML API Version 2.0.

As I mentioned earlier, the latest version has some breaking changes, so the MSDN team is also planning to update the code and content of the Open XML Format SDK related articles such as:

Manipulate Excel 2007 and PowerPoint 2007 Files with the Open XML Object Model (Part 1 of 2)

Manipulate Excel 2007 and PowerPoint 2007 Files with the Open XML Object Model (Part 2 of 2)

Manipulate Word 2007 Files with the Open XML Object Model (Part 1 of 3)

Manipulate Word 2007 Files with the Open XML Object Model (Part 2 of 3)

Manipulate Word 2007 Files with the Open XML Object Model (Part 3 of 3)

Build Server-Side Document Generation Solutions Using the Open XML Object Model (Part 1 of 2)

Build Server-Side Document Generation Solutions Using the Open XML Object Model (Part 2 of 2)

Additional Resources

I recommend that you continue to monitor the following blogs for more news about the Open XML Format SDK:

More code samples: OpenXmlDeveloper.org site

You can also watch Zeyad's and Eric's interview to learn more about the future of the Open XML Format SDK.

Please continue to use the following two resources to ask questions to the product team and provide feedback :

  1. MSDN Forum: Open XML Format SDK: Use the forum to ask questions and provide suggestions. The product team is monitoring and moderating this forum.
  2. MSDN Library: Open XML Format SDK (Online version) Wiki: The online version of the SDK is Wiki enabled. This allows you to add comments and report bugs you find on documentation. To leave comments, use the "Add Community Content" link located at the bottom of each topic.

Enjoy!

Bookmark and Share

Comments

  • Anonymous
    June 10, 2008
    Just read fantastic news from Erika Ehrli Cabral that the Open XML SDK 1.0 is now available. She writes:

  • Anonymous
    June 10, 2008
    Version 1 of the Open XML SDK is now available for free download from MSDN. Here are the links: Open

  • Anonymous
    June 10, 2008
    使用这个API,程序员们就可以通过自己的程序直接生成Word和,PowerPoint,Excel2007版本的文件,这是OpenXML编程的基础.今天OpenXMLFormatSDK1.0正...

  • Anonymous
    June 10, 2008
    Tänasest on kättesaadav OpenXML Fomrat SDK 1.0 ehk siis .Net -i API, millega on võimalik programmiliselt

  • Anonymous
    June 11, 2008
    Microsoft announced this week the release of Version 1 of the Open XML Formats SDK, an API that allows...

  • Anonymous
    June 11, 2008
    I'm very excited today to announce a new open source project, PowerTools for Open XML . Processing Open

  • Anonymous
    June 11, 2008
    Let’s see what the OpenXML guru’s take about it .. Here is full description from none other then …Erika

  • Anonymous
    June 11, 2008
    Open XML Format SDK – RTM , Version 1.0 Overview The 2007 Microsoft® Office system introduces a new file

  • Anonymous
    June 11, 2008
    Дякую аж підскакую. Тулза просто фантастична

  • Anonymous
    June 11, 2008
    Very cool post from Eric White that introduces a new CodePlex project to create PowerTools for OpenXML

  • Anonymous
    June 12, 2008
    Open XML Format SDK Version 1.0 zum Download freigegeben

  • Anonymous
    June 13, 2008
    A couple of days ago the Open XML Format SDK was posted on Microsofts download site: http://www.microsoft.com/downloads/details.aspx?FamilyID=ad0b72fb-4a1d-4c52-bdb5-7dd7e816d046&amp;displaylang=en

  • Anonymous
    June 14, 2008
    使用这个API,程序员们就可以通过自己的程序直接生成Word和,PowerPoint,Excel2007版本的文件,这是OpenXML编程的基础.今天OpenXMLFormatSDK1.0正...

  • Anonymous
    June 15, 2008
    Die Version 1 deckt die Open Packaging Conventions ab, man braucht also keine Relationships oder Content

  • Anonymous
    June 23, 2008
    Hi, Using Open XML Format SDK 1.0 (Web application : C # or VB.Net), I want to build a file .docx from several other files .docx, each one constitutes a part of the final document. For example: Header.docx (which contains the Header of the final document - text and images, MailMerging fields...) footer.docx (which contains the footer of the final document - text and images, MailMerging fields...) Paragraph-1.docx (which contains the paragraph 1 of the final document - text and images, MailMerging fields...) some one have an idea? Thank you.

  • Anonymous
    July 01, 2008
    Hi Devam, The Open XML Format SDK 1.0 provides several How Do I samples that show you how to manipulate parts programmatically. http://msdn.microsoft.com/en-us/library/bb456489.aspx