Code snippets for working with the Open XML formats

This is my first time on an airplane with wifi, so I'm pleased to bring this news to you from somewhere over the pacific.

I've been promising for the past year that one of the big things we're going to do this time around that we didn't do much of with the 2003 XML formats was to provide a whole bunch of examples. The site is going to be the best place for people to share their experiences and code, but it's also really important that we at Microsoft give examples of how to do various things.

With the 2003 formats, we had every element and attribute documented, but we didn't do a great job of showing how to actually use the formats. This time around, we want to provide examples that will provide good prescriptive guides on how to do various things with the files. We came up with a huge list of what we thought people would like to see, and it was pretty hard to narrow it down.

We now have the first set of examples, and they all work against the Beta 2 version of the file formats (they will also be updated to match the final versions once they are finished in Ecma). You can go grab them up here:

The examples leverage the WinFX system.IO.packaging interface, but they could also be mapped to function with other tools (just like the java examples up on openxmldeveloper). You'll probably notice that the examples are some of the more basic ones that we could think of, but it made sense to use these as the starting point. We will most likely start building some more complex ones as well that leverage one or more of the initial examples as building blocks.

There are 40 examples overall, and I'd love to hear what you think. Also let me know if there are other things you'd like to see us add to the list. Kevin Boske who is on the programmability team for Office was tasked with pulling these together, and I'm really appreciative of the work that he and Ken Getz did on these. Kevin already blogged on this earlier today, and there is also mention of them up on