Microsoft has released a CTP for Microsoft SDK for Open XML Formats, which can be downloaded here.

The SDK contains a strongly typed library, built on top of System.IO.Packaging namespace, for creating documents based on the Open XML Format. Great, now we don’t have to use the System.Xml.XmlWriter to create Office 2007 documents.

Here is a sample on how to write out the number of characters in a Word 2007 document:

XmlDocument extendedProperties = new XmlDocument();
using (WordprocessingDocument wordDocument = WordprocessingDocument.Open("document.docx", false)) {
      ExtendedFilePropertiesPart part = wordDocument.ExtendedFilePropertiesPart;
XmlNodeList characters = extendedProperties.GetElementsByTagName("Characters");

.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; overflow-x:visible;border:0px} .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }