Yesterday our folks at Office Online released the first set of the Open XML Code Snippets to the web. These snippets work with Visual Studio.NET 2005 and are written in C# and VB.NET using the WinFX (oops) .NET 3.0 System.IO.Packaging API.

When we started working on these, I had a list of over 150 scenarios to choose from, but I had to narrow it down, so I focused on scenarios that would help you learn some of the patterns for working with the Open XML Formats but would aslo be resuable in your solutions.  For example, we have snippets for removing parts (Sheets, Slides, Comments, VBA projects).  Removing parts is definately a common scenario.

There's snippets for editing data, like accepting comments by a particular user.  This one is useful as you must not only know the parts to find (Comments) but also must work with the XML in the document. 

There are snippets specicially for each application's files.  We've got snippets for editing data in a cell.  We've got a snippet for reording slides in a presentation.  We've got a snippet for adding RibbonX customizations.  There are over 40 in all.

All the snippets were written in both VB.NET and C# by Ken Getz.  Ken did a great job.  Everytime we made a change to the file format, Ken would update the snippets.  (Of course, we kept improving the file format faster than I could keep up with shipping the snippets).

So, here they are, in Beta 2 format.  Please download them and give them a try.  I think Doug has some more notes over on OpenXMLDeveloper about these. 

I'm out on vacation, posting this from my parents old machine (part of my vacation is to setup their new machine), but I will check the blog periodically. Please report any issues, comments or praise you have for the snippets in the comments of this post.