<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Brian Jones: Office Solutions</title><link>http://blogs.msdn.com/b/brian_jones/</link><description>I&amp;#39;m Brian Jones, the group program manager of the Office Solutions Framework team. </description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>A look into the user experiences around apps for Office and SharePoint</title><link>http://blogs.msdn.com/b/brian_jones/archive/2012/08/06/a-look-into-the-user-experiences-around-apps-for-office-and-sharepoint.aspx</link><pubDate>Tue, 07 Aug 2012 01:31:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10337345</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=10337345</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2012/08/06/a-look-into-the-user-experiences-around-apps-for-office-and-sharepoint.aspx#comments</comments><description>&lt;p&gt;We're going to have a few posts this week up on the Office Next blog that drill into the new app model from three perspectives: the end user; the developer; and the administrator. This first post that goes into the end user experience is now live:&amp;nbsp;http://blogs.office.com/b/office-next/archive/2012/08/06/introducing-apps-for-the-new-office-and-sharepoint-and-the-office-store.aspx&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10337345" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OfficeApps/">OfficeApps</category></item><item><title>Open XML SDK 2.5 is now available</title><link>http://blogs.msdn.com/b/brian_jones/archive/2012/07/27/open-xml-sdk-2-5-is-now-available.aspx</link><pubDate>Fri, 27 Jul 2012 15:50:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10334233</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=10334233</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2012/07/27/open-xml-sdk-2-5-is-now-available.aspx#comments</comments><description>&lt;p&gt;There is new a CTP available of the Open XML SDK version 2.5: &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=30425"&gt;http://www.microsoft.com/en-us/download/details.aspx?id=30425&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As I mentioned in &lt;a href="http://blogs.msdn.com/b/officeapps/archive/2012/07/23/introducing-apps-for-the-new-office-and-sharepoint.aspx"&gt;my post earlier this week&lt;/a&gt;, Open XML is an important piece of our overall application model for Office 365 solutions.&lt;/p&gt;
&lt;p&gt;Here are a few of the things that are new in this version of the SDK:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;New classes for file format extensions in Microsoft Office 2013 Preview&lt;/li&gt;
&lt;li&gt;Built on .NET Framework 4.0&lt;/li&gt;
&lt;li&gt;Reads the ISO Strict Format&lt;/li&gt;
&lt;li&gt;Fixes to some of the bugs from 2.0 (e.g. whitespaces in .pptx document file)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Take a look!&lt;/p&gt;
&lt;p&gt;-Brian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10334233" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category></item><item><title>New post up on the apps for Office blog</title><link>http://blogs.msdn.com/b/brian_jones/archive/2012/07/23/new-post-up-on-the-apps-for-office-blog.aspx</link><pubDate>Mon, 23 Jul 2012 15:47:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10332594</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=10332594</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2012/07/23/new-post-up-on-the-apps-for-office-blog.aspx#comments</comments><description>&lt;p&gt;I just posted on the apps for Office blog, giving some more background into the new model: &lt;a href="http://blogs.msdn.com/b/officeapps/archive/2012/07/23/introducing-apps-for-the-new-office-and-sharepoint.aspx"&gt;http://blogs.msdn.com/b/officeapps/archive/2012/07/23/introducing-apps-for-the-new-office-and-sharepoint.aspx&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10332594" width="1" height="1"&gt;</description></item><item><title>Test Message</title><link>http://blogs.msdn.com/b/brian_jones/archive/2012/07/10/test-message.aspx</link><pubDate>Tue, 10 Jul 2012 16:44:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10328423</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=10328423</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2012/07/10/test-message.aspx#comments</comments><description>&lt;p&gt;Test message... haven't used the blog in awhile, so want to make sure it still works! :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10328423" width="1" height="1"&gt;</description></item><item><title>Writing Large Excel Files with the Open XML SDK</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/06/22/writing-large-excel-files-with-the-open-xml-sdk.aspx</link><pubDate>Tue, 22 Jun 2010 16:37:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10028570</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=10028570</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/06/22/writing-large-excel-files-with-the-open-xml-sdk.aspx#comments</comments><description>&lt;p&gt;In my last post, I showed you guys how to &lt;a href="http://blogs.msdn.com/b/brian_jones/archive/2010/05/27/parsing-and-reading-large-excel-files-with-the-open-xml-sdk.aspx"&gt;use the Open XML SDK to read and parse large Excel files&lt;/a&gt;. Today, I am going to show you how to write large Excel files with the &lt;a href="http://blogs.msdn.com/b/brian_jones/archive/2010/03/12/announcing-the-release-of-the-open-xml-sdk-2-0.aspx"&gt;Open XML SDK&lt;/a&gt;. Like in the case of reading, the Open XML SDK provides two approaches for writing Open XML files: 1. using the DOM, 2. using the SAX-like writing capability. All of my examples on this blog have been around using the Open XML SDK DOM to write Open XML files. The DOM makes it easy because everything is strongly typed. Unfortunately, the DOM approach requires loading entire Open XML parts in memory, which can result in Out of Memory exceptions, especially when dealing with very large files. Let's compare the DOM and SAX-like approaches. &lt;/p&gt;  &lt;p&gt;If you want to jump straight into the code, feel free to download the solution &lt;a href="http://zeyadrajabi.members.winisp.net/sourcecode/WriteLargeExcelFiles.zip"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;object width="640" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/YFZ_fJBPS80&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/YFZ_fJBPS80&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;  &lt;h2&gt;Scenario &lt;/h2&gt;  &lt;p&gt;Imagine a scenario where I work for a financial company that deals with very large amounts of data. This data gets updated on a daily basis and is stored in a database. The company's analysts use Excel as a means of mining and understanding the data. To support the analysts' needs, the company needs to create and update Excel spreadsheets every morning. These spreadsheets typically grow to sizes exceeding hundreds of megabytes. &lt;/p&gt;  &lt;h2&gt;Solution &lt;/h2&gt;  &lt;p&gt;The scenario described above uses many of the general concepts described in a previous post on &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/11/04/document-assembly-solution-for-spreadsheetml.aspx"&gt;writing data from a database into an Excel file&lt;/a&gt;. Today, I will show you how to accomplish the scenario using both the DOM and SAX-like approaches. To accomplish the scenario we will need to take the following actions: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create an empty Spreadsheet template using Excel &lt;/li&gt;    &lt;li&gt;Open the template using the Open XML SDK &lt;/li&gt;    &lt;li&gt;Connect to the database that contains all the relevant data (for the sake of simplicity, this blog post will instead write random values to cells) &lt;/li&gt;    &lt;li&gt;Get the main workbook part &lt;/li&gt;    &lt;li&gt;Get the appropriate worksheet &lt;/li&gt;    &lt;li&gt;Get the sheetData element, which will contain the data for a given spreadsheet &lt;/li&gt;    &lt;li&gt;For the number of rows and columns that represent the dimensions of data to be inserted, add a new cell with appropriate data &lt;/li&gt;    &lt;li&gt;Append rows to the sheetData element &lt;/li&gt;    &lt;li&gt;Save and close &lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Step 1 – Setup the right template &lt;/h2&gt;  &lt;p&gt;As is the case for most of my blog posts, the easiest way to start any Open XML SDK solution is to create the right starting template. In this case, I am going to create a blank Excel spreadsheet with one sheet in Excel. The template will look like the following: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/WritingLargeExcelFileswiththeOpenXMLSDK_8B3D/image.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/WritingLargeExcelFileswiththeOpenXMLSDK_8B3D/image_thumb.png" width="689" height="609" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Open XML SDK DOM Approach &lt;/h2&gt;  &lt;p&gt;The SDK DOM approach is pretty straight forward. The method below will write random values to cells within a given set of dimensions specified by the number of rows and columns. The random values will be calculated by Excel using the &lt;span style="font-family: courier new; color: #a31515; font-size: 10pt"&gt;RAND()&lt;/span&gt; formula, which is specified by the &lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;CellFormula&lt;/span&gt; &lt;/span&gt;class. &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 667px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; WriteRandomValuesDOM(&lt;span style="color: blue"&gt;string&lt;/span&gt; filename, &lt;span style="color: blue"&gt;int&lt;/span&gt; numRows, &lt;span style="color: blue"&gt;int&lt;/span&gt; numCols) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt; myDoc = &lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt;.Open(filename, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorkbookPart&lt;/span&gt; workbookPart = myDoc.WorkbookPart; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; worksheetPart = workbookPart.WorksheetParts.First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SheetData&lt;/span&gt; sheetData = worksheetPart.Worksheet.Elements&amp;lt;&lt;span style="color: #2b91af"&gt;SheetData&lt;/span&gt;&amp;gt;().First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;for&lt;/span&gt; (&lt;span style="color: blue"&gt;int&lt;/span&gt; row = 0; row &amp;lt; numRows; row++) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Row&lt;/span&gt; r = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Row&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;for&lt;/span&gt; (&lt;span style="color: blue"&gt;int&lt;/span&gt; col = 0; col &amp;lt; numCols; col++) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt; c = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;CellFormula&lt;/span&gt; f = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CellFormula&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;f.CalculateCell = &lt;span style="color: blue"&gt;true&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;f.Text = &lt;span style="color: #a31515"&gt;&amp;quot;RAND()&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;c.Append(f); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;CellValue&lt;/span&gt; v = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CellValue&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;c.Append(v); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;r.Append(c); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sheetData.Append(r); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;The method above will definitely work for writing cell values within a worksheet. However, if the dimension specified is quite large then the program's memory footprint will also be quite large. In fact, you are left at the mercy of the garbage collector, which may result in the program throwing an Out of Memory exception. &lt;/p&gt;  &lt;h2&gt;Open XML SDK SAX-Like Approach &lt;/h2&gt;  &lt;p&gt;The &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlReader &lt;/span&gt;and&lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt; OpenXmlWriter&lt;/span&gt; can be used together to alleviate some of the performance and/or memory concerns when developing an Open XML solution. You can create an &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlReader &lt;/span&gt;and an&lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt; OpenXmlWriter&lt;/span&gt; object on an entire part without loading the part in memory. The &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlReader &lt;/span&gt;class allows you to iterate the entire xml tree of a part one node at a time. Similarly, the &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlWriter&lt;/span&gt; class allows you to write xml nodes within a part one node at a time. &lt;/p&gt;  &lt;p&gt;In the case of this solution, we will need to read the original worksheet part and then update the worksheet with the appropriate data. We are going to use an &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlReader &lt;/span&gt;object to read the original worksheet part and find the place in the file where we will add data. We are then going to use an &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlWriter&lt;/span&gt; object to write values to the worksheet part. You may be tempted to create an &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlReader &lt;/span&gt;object and an &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlWriter&lt;/span&gt; object on the same part. I would recommend against using this strategy. Writing data to a part that you are reading using the &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlReader&lt;/span&gt; and the &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlWriter&lt;/span&gt; may result in the&lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt; OpenXmlReader&lt;/span&gt; losing its place in the xml tree. Instead, you should create a temporary worksheet part where you can write values to using the &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlWriter&lt;/span&gt; class. The following code creates an &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlReader &lt;/span&gt;object and an &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlWriter &lt;/span&gt;object for worksheet parts: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 667px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; WriteRandomValuesSAX(&lt;span style="color: blue"&gt;string&lt;/span&gt; filename, &lt;span style="color: blue"&gt;int&lt;/span&gt; numRows, &lt;span style="color: blue"&gt;int&lt;/span&gt; numCols) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt; myDoc = &lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt;.Open(filename, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorkbookPart&lt;/span&gt; workbookPart = myDoc.WorkbookPart; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; worksheetPart = workbookPart.WorksheetParts.First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; origninalSheetId = workbookPart.GetIdOfPart(worksheetPart); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; replacementPart = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;workbookPart.AddNewPart&amp;lt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt;&amp;gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; replacementPartId = workbookPart.GetIdOfPart(replacementPart); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; reader = &lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt;.Create(worksheetPart); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;OpenXmlWriter&lt;/span&gt; writer = &lt;span style="color: #2b91af"&gt;OpenXmlWriter&lt;/span&gt;.Create(replacementPart); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;Once we have the appropriate objects created, the next step is to write everything we read into the new worksheet part until we reach the &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;SheetData&lt;/span&gt; object. Once we reach the &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;SheetData&lt;/span&gt; object, we can start writing cell values within a given set of dimensions specified by the number of rows and columns. The following code accomplishes this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 667px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; WriteRandomValuesSAX(&lt;span style="color: blue"&gt;string&lt;/span&gt; filename, &lt;span style="color: blue"&gt;int&lt;/span&gt; numRows, &lt;span style="color: blue"&gt;int&lt;/span&gt; numCols) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt; myDoc = &lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt;.Open(filename, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Row&lt;/span&gt; r = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Row&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt; c = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;CellFormula&lt;/span&gt; f = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CellFormula&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;f.CalculateCell = &lt;span style="color: blue"&gt;true&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;f.Text = &lt;span style="color: #a31515"&gt;&amp;quot;RAND()&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;c.Append(f); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;CellValue&lt;/span&gt; v = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;CellValue&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;c.Append(v); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;while&lt;/span&gt; (reader.Read()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (reader.ElementType == &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;SheetData&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (reader.IsEndElement) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;continue&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;writer.WriteStartElement(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SheetData&lt;/span&gt;()); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;for&lt;/span&gt; (&lt;span style="color: blue"&gt;int&lt;/span&gt; row = 0; row &amp;lt; numRows; row++) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;writer.WriteStartElement(r); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;for&lt;/span&gt; (&lt;span style="color: blue"&gt;int&lt;/span&gt; col = 0; col &amp;lt; numCols; col++) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;writer.WriteElement(c); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;writer.WriteEndElement(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;writer.WriteEndElement(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; color: blue; font-size: 10pt"&gt;else &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (reader.IsStartElement) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;writer.WriteStartElement(reader); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt; &lt;span style="color: blue"&gt;if&lt;/span&gt; (reader.IsEndElement) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;writer.WriteEndElement(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;Notice that the&lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt; OpenXmlWriter&lt;/span&gt; class requires us to write both the start and end elements. Invoking the method &lt;span style="font-family: courier new; font-size: 10pt"&gt;WriteEndElement() &lt;/span&gt;off of the &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlWriter&lt;/span&gt; class ensures that the appropriate start element is closed. &lt;/p&gt;  &lt;p&gt;We're almost done. The last step is to close the reader and writer and replace the original worksheet part with the replacement part. Remember that the main workbook part contains the list of worksheets within the workbook, which means we need to update the xml contained in that part. The following code accomplishes these tasks: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 667px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; WriteRandomValuesSAX(&lt;span style="color: blue"&gt;string&lt;/span&gt; filename, &lt;span style="color: blue"&gt;int&lt;/span&gt; numRows, &lt;span style="color: blue"&gt;int&lt;/span&gt; numCols) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt; myDoc = &lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt;.Open(filename, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;reader.Close(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;writer.Close(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Sheet&lt;/span&gt; sheet = workbookPart.Workbook.Descendants&amp;lt;&lt;span style="color: #2b91af"&gt;Sheet&lt;/span&gt;&amp;gt;() &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;.Where(s =&amp;gt; s.Id.Value.Equals(origninalSheetId)).First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sheet.Id.Value = replacementPartId; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;workbookPart.DeletePart(worksheetPart); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Conclusion &lt;/h2&gt;  &lt;p&gt;This post gives you more insight into reading and writing large Open XML files, while avoiding performance or Out of Memory exceptions. Let me know if you guys have other Open XML SDK related post requests. &lt;/p&gt;  &lt;p&gt;Zeyad Rajabi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10028570" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2007/">Office 2007</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Excel/">Excel</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Parsing and Reading Large Excel Files with the Open XML SDK</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/05/27/parsing-and-reading-large-excel-files-with-the-open-xml-sdk.aspx</link><pubDate>Thu, 27 May 2010 20:03:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10016539</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>13</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=10016539</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/05/27/parsing-and-reading-large-excel-files-with-the-open-xml-sdk.aspx#comments</comments><description>&lt;p&gt;I want to thank you guys for leaving blog post requests. Today's post will focus on one of your requests: parsing and reading large Excel files with the Open XML SDK. The &lt;a href="http://blogs.msdn.com/b/brian_jones/archive/2010/03/12/announcing-the-release-of-the-open-xml-sdk-2-0.aspx"&gt;Open XML SDK&lt;/a&gt; provides two approaches for parsing Open XML files: 1. &lt;a href="http://blogs.msdn.com/b/brian_jones/archive/2009/01/28/traversing-in-the-open-xml-dom.aspx"&gt;using the SDK DOM&lt;/a&gt;, 2. using the SAX-like reading/writing capabilities. The SDK DOM makes it easy to query and parse Open XML files due to strongly typed classes. Unfortunately, the DOM approach requires loading entire Open XML parts in memory, which can sometimes cause Out of Memory exceptions when dealing with really large files. The SAX-like reading/writing capability of the SDK provides a faster and less memory intensive approach. Let's compare the two approaches. &lt;/p&gt;  &lt;p&gt;If you want to jump straight into the code, feel free to download the solution &lt;a href="http://zeyadrajabi.members.winisp.net/sourcecode/ReadLargeExcelFiles.zip"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;object width="480" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/fNKPWNs7j6g&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/fNKPWNs7j6g&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;  &lt;h2&gt;Scenario &lt;/h2&gt;  &lt;p&gt;Imagine a scenario where I work for a financial company that deals with very large Excel spreadsheets. These spreadsheets are updated daily by analysts and can easily grow to sizes exceeding hundreds of megabytes. At the end of the day a solution is used to read and extract relevant data from every spreadsheet. &lt;/p&gt;  &lt;p&gt;Here is a screenshot of an example workbook with millions of cells of data: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/ParsingandReadingLargeExcelFileswiththeO_B954/image.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/ParsingandReadingLargeExcelFileswiththeO_B954/image_thumb.png" width="853" height="550" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Solution &lt;/h2&gt;  &lt;p&gt;The scenario described above is pretty simple and involves many of the general concepts described in a previous post on &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/11/10/reading-data-from-spreadsheetml.aspx"&gt;reading data from Excel files&lt;/a&gt;. The main difference in today's post is that I will show you the solution using both the DOM and SAX-like approaches. To accomplish the scenario we will need to take the following actions: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Open the workbook using the Open XML SDK &lt;/li&gt;    &lt;li&gt;Get the main workbook part &lt;/li&gt;    &lt;li&gt;Get the appropriate worksheet &lt;/li&gt;    &lt;li&gt;Read every cell value in the sheet &lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Open XML SDK DOM Approach &lt;/h2&gt;  &lt;p&gt;The SDK DOM approach is pretty straight forward. The method below will read every cell value for each row contained within the sheet data. &lt;/p&gt;  &lt;p&gt;&lt;em&gt;Note that code below works for cells that contain numeric values. Cells that contain other types of content will need a different type of solution. &lt;/em&gt;&lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 655px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; ReadExcelFileDOM(&lt;span style="color: blue"&gt;string&lt;/span&gt; filename) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt; myDoc = &lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt;.Open(filename, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorkbookPart&lt;/span&gt; workbookPart = myDoc.WorkbookPart; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; worksheetPart = workbookPart.WorksheetParts.First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SheetData&lt;/span&gt; sheetData = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;worksheetPart.Worksheet.Elements&amp;lt;&lt;span style="color: #2b91af"&gt;SheetData&lt;/span&gt;&amp;gt;().First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Row&lt;/span&gt; r &lt;span style="color: blue"&gt;in&lt;/span&gt; sheetData.Elements&amp;lt;&lt;span style="color: #2b91af"&gt;Row&lt;/span&gt;&amp;gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt; c &lt;span style="color: blue"&gt;in&lt;/span&gt; r.Elements&amp;lt;&lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt;&amp;gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; text = c.CellValue.Text; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;The method above will definitely work for reading cell values within a worksheet. However, if the worksheet is quite large then the program's memory footprint will also be quite large. In fact, you are left at the mercy of the garbage collector, which may result in the program throwing an Out of Memory exception. &lt;/p&gt;  &lt;h2&gt;Open XML SDK SAX-Like Approach &lt;/h2&gt;  &lt;p&gt;If you have performance and/or memory concerns when developing an Open XML solution then you should look into using the &lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; &lt;/span&gt;and &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlWriter&lt;/span&gt;. In today's post I will cover how to use the &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlReader&lt;/span&gt;. I'll try to cover the &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;OpenXmlWriter&lt;/span&gt; in a future post. &lt;/p&gt;  &lt;p&gt;The method below will read every cell value for each row contained within the sheet data using the SAX-like approach. &lt;/p&gt;  &lt;p&gt;&lt;em&gt;Note that code below works for cells that contain numeric values. Cells that contain other types of content will need a different type of solution. &lt;/em&gt;&lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 655px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; ReadExcelFileSAX(&lt;span style="color: blue"&gt;string&lt;/span&gt; filename) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt; myDoc = &lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt;.Open(filename, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorkbookPart&lt;/span&gt; workbookPart = myDoc.WorkbookPart; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; worksheetPart = workbookPart.WorksheetParts.First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; reader = &lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt;.Create(worksheetPart); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; text; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;while&lt;/span&gt; (reader.Read()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (reader.ElementType == &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;CellValue&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;text = reader.GetText(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;The method above takes advantage of the &lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; &lt;/span&gt;class, which allows you to read an entire part without loading the part in memory. The &lt;span style="font-family: courier new; font-size: 10pt"&gt;Create&lt;/span&gt; method has the following signatures: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; Create(&lt;span style="color: #2b91af"&gt;OpenXmlElement&lt;/span&gt; openXmlElement); &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; Create(&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt; openXmlPart); &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; Create(&lt;span style="color: #2b91af"&gt;Stream&lt;/span&gt; partStream); &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; Create(&lt;span style="color: #2b91af"&gt;OpenXmlElement&lt;/span&gt; openXmlElement, &lt;span style="color: blue"&gt;bool&lt;/span&gt; readMiscNodes); &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; Create(&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt; openXmlPart, &lt;span style="color: blue"&gt;bool&lt;/span&gt; readMiscNodes);&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; Create(&lt;span style="color: #2b91af"&gt;Stream&lt;/span&gt; partStream, &lt;span style="color: blue"&gt;bool&lt;/span&gt; readMiscNodes);&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;As you can see, the &lt;span style="font-family: courier new; font-size: 10pt"&gt;Create&lt;/span&gt; method allows you to read either a part or an xml subtree given a specific element. There are methods that allow you to skip miscellaneous nodes that are not associated with the Open XML format. Using the &lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;OpenXmlReader&lt;/span&gt; &lt;/span&gt;class allows you to iterate the entire xml tree one node at a time. &lt;/p&gt;  &lt;h2&gt;Conclusion &lt;/h2&gt;  &lt;p&gt;Hopefully, this post gives you more insight into reading large Open XML files, while avoiding performance or Out of Memory Exceptions. If you guys have other Open XML SDK related post requests, let me know. &lt;/p&gt;  &lt;p&gt;Thanks, &lt;/p&gt;  &lt;p&gt;Zeyad Rajabi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10016539" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2007/">Office 2007</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Excel/">Excel</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Improvements Made to the Final Open XML SDK 2.0 compared to the December 2009 CTP</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/05/03/improvements-made-to-the-final-open-xml-sdk-2-0-compared-to-the-december-2009-ctp.aspx</link><pubDate>Mon, 03 May 2010 17:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10006479</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=10006479</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/05/03/improvements-made-to-the-final-open-xml-sdk-2-0-compared-to-the-december-2009-ctp.aspx#comments</comments><description>&lt;P&gt;In a &lt;A href="http://blogs.msdn.com/brian_jones/archive/2010/03/12/announcing-the-release-of-the-open-xml-sdk-2-0.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2010/03/12/announcing-the-release-of-the-open-xml-sdk-2-0.aspx"&gt;previous post&lt;/A&gt;, where I announced the release of the &lt;A href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0" mce_href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0"&gt;Open XML SDK 2.0&lt;/A&gt;, I promised to give you guys a list of improvements and breaking changes made to the SDK compared to the &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/12/14/announcing-the-release-of-the-december-2009-ctp-for-the-open-xml-sdk.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/12/14/announcing-the-release-of-the-december-2009-ctp-for-the-open-xml-sdk.aspx"&gt;December 2009 CTP&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;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. &lt;/P&gt;
&lt;H2&gt;Autosave for Creating Documents &lt;/H2&gt;
&lt;P&gt;One of the changes we made to the SDK is around supporting autosave for document creation. Back in &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/08/27/announcing-the-release-of-the-august-2009-ctp-for-the-open-xml-sdk.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/08/27/announcing-the-release-of-the-august-2009-ctp-for-the-open-xml-sdk.aspx"&gt;August 2009&lt;/A&gt; 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: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Create(&lt;SPAN style="COLOR: #2b91af"&gt;Package&lt;/SPAN&gt; package, &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocumentType&lt;/SPAN&gt; type, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave);&lt;/SPAN&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Create(&lt;SPAN style="COLOR: #2b91af"&gt;Stream&lt;/SPAN&gt; stream, &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocumentType&lt;/SPAN&gt; type, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave);&lt;/SPAN&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Create(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; path, &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocumentType&lt;/SPAN&gt; type, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave);&lt;/SPAN&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocument&lt;/SPAN&gt; Create(&lt;SPAN style="COLOR: #2b91af"&gt;Package&lt;/SPAN&gt; package, &lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocumentType&lt;/SPAN&gt; type, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave);&lt;/SPAN&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocument&lt;/SPAN&gt; Create(&lt;SPAN style="COLOR: #2b91af"&gt;Stream&lt;/SPAN&gt; stream, &lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocumentType&lt;/SPAN&gt; type, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave);&lt;/SPAN&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocument&lt;/SPAN&gt; Create(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; path, &lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocumentType&lt;/SPAN&gt; type, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave);&lt;/SPAN&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;PresentationDocument&lt;/SPAN&gt; Create(&lt;SPAN style="COLOR: #2b91af"&gt;Package&lt;/SPAN&gt; package, &lt;SPAN style="COLOR: #2b91af"&gt;PresentationDocumentType&lt;/SPAN&gt; type, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave);&lt;/SPAN&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;PresentationDocument&lt;/SPAN&gt; Create(&lt;SPAN style="COLOR: #2b91af"&gt;Stream&lt;/SPAN&gt; stream, &lt;SPAN style="COLOR: #2b91af"&gt;PresentationDocumentType&lt;/SPAN&gt; type, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave);&lt;/SPAN&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;PresentationDocument&lt;/SPAN&gt; Create(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; path, &lt;SPAN style="COLOR: #2b91af"&gt;PresentationDocumentType&lt;/SPAN&gt; type, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave);&lt;/SPAN&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;H2&gt;Improved Namespace Processing &lt;/H2&gt;
&lt;P&gt;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 &amp;lt;p&amp;gt; with the prefix w, such as &amp;lt;w:p&amp;gt;. 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. &lt;/P&gt;
&lt;H2&gt;Breaking Changes in the Final Release of the Open XML SDK 2.0 &lt;/H2&gt;
&lt;P&gt;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: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 319px"&gt;
&lt;COL style="WIDTH: 319px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 2.25pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #4f81bd 1pt solid; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;&lt;STRONG&gt;December 2009 CTP Class/Attribute Name&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 2.25pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #4f81bd 1pt solid; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;&lt;STRONG&gt;Final RTW SDK Class/Attribute Name&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="BACKGROUND: #d3dfee"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Spreadsheet.ObjectAnchor::Z_order&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Spreadsheet.ObjectAnchor::ZOrder&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.AdditionalCharacteristics&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.AdditionalCharacteristicsInfo&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="BACKGROUND: #d3dfee"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Wordprocessing.Alias&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Wordprocessing.SdtAlias&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Wordprocessing.LatentStyleException&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Wordprocessing.LatentStyleExceptionInfo&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="BACKGROUND: #d3dfee"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Drawing.Diagrams.Else&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Drawing.Diagrams.DiagramChooseElse&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Drawing.Diagrams.If &lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Drawing.Diagrams.DiagramChooseIf&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="BACKGROUND: #d3dfee"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Math.Function&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Math.MathFunction&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Vml.Handle&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Vml.ShapeHandle&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="BACKGROUND: #d3dfee"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Vml.Handles&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Vml.ShapeHandles&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Office2010.Ink.Property&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Office2010.Ink.ContextNodeProperty&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="BACKGROUND: #d3dfee"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.CustomProperties.Property&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.CustomProperties.CustumDocumentProperty&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Spreadsheet.Set&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.Spreadsheet.TupleSet&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="BACKGROUND: #d3dfee"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.VariantTypes.VTOStream&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.VariantTypes.VTOStreamData&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.VariantTypes.VTStream&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.VariantTypes.VTStreamData&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="BACKGROUND: #d3dfee"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.VariantTypes.VTVStream&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.VariantTypes.VTVStreamData&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.CustomProperties.CustumDocumentProperty&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;DocumentFormat.OpenXml.CustomProperties.CustomDocumentProperty&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;EM&gt;Note: The change from Alias to SdtAlias will affect the most people. &lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Zeyad Rajabi&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10006479" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category></item><item><title>Zeyad Rajabi’s Open XML SDK Blog Map</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/04/06/zeyad-rajabi-s-open-xml-sdk-blog-map.aspx</link><pubDate>Tue, 06 Apr 2010 17:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9991283</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9991283</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/04/06/zeyad-rajabi-s-open-xml-sdk-blog-map.aspx#comments</comments><description>&lt;p&gt;This post will represent the most up-to-date blog map for topics on the Open XML SDK. &lt;/p&gt;  &lt;h2&gt;Open XML SDK Basics &lt;/h2&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 222px" /&gt;&lt;col style="width: 516px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Topic&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/01/12/open-xml-sdk-the-basics.aspx"&gt;&lt;strong&gt;Open XML SDK… the Basics&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn about classes of the SDK and their first class properties. This post is a great introduction to the Open XML SDK. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/01/28/traversing-in-the-open-xml-dom.aspx"&gt;&lt;strong&gt;Traversing in the Open XML DOM&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn the basic techniques of traversing in the Open XML DOM tree using the Open XML SDK.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/09/17/open-xml-sdk-code-snippets.aspx"&gt;&lt;strong&gt;Open XML SDK Code Snippets&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to leverage the Open XML SDK code snippets to create rich solutions.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/09/24/finding-open-xml-errors-with-open-xml-sdk-validation.aspx"&gt;&lt;strong&gt;Finding Open XML Errors with Open XML SDK Validation&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to use the Open XML SDK to validate your Open XML files.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="Announcing%20the%20Release%20of%20the%20December%202009%20CTP%20for%20the%20Open%20XML%20SDK"&gt;&lt;strong&gt;Open XML SDK Productivity Tool&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to use the Open XML SDK Productivity Tool. This tool is the easiest way to learn about the Open XML file formats and the Open XML SDK. &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/KSSMLR19JWA&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/KSSMLR19JWA&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Word &lt;/h2&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 222px" /&gt;&lt;col style="width: 516px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Topic&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/12/08/the-easy-way-to-assemble-multiple-word-documents.aspx"&gt;&lt;strong&gt;The Easy Way to Assemble Multiple Documents&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to leverage altChunks to easily create a robust document assembly solution in less than a thirty lines of code.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/01/05/taking-advantage-of-bound-content-controls.aspx"&gt;&lt;strong&gt;Taking Advantage of Bound Content Controls&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to leverage bound content controls to bind to custom XML.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/01/19/pushing-data-from-a-database-into-a-word-document.aspx"&gt;&lt;strong&gt;Pushing Data from a Database into a Word Document&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to build a repeating table within WordprocessingML based on data within a database.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/02/06/removing-comments-from-a-wordprocessing-document-programmatically.aspx"&gt;&lt;strong&gt;Removing Comments from a Wordprocessing Document Programmatically&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to remove comments from a Word document. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/05/05/retrieving-word-content-based-on-styles.aspx"&gt;&lt;strong&gt;Retrieving Word Content Based on Styles&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to retrieve content in a document based on style information.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/06/15/removing-page-and-section-breaks-from-a-word-document.aspx"&gt;&lt;strong&gt;Removing Page and Section Breaks from a Word Document&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to remove page and section breaks in a Word document. &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/yA3TFolIYco&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/yA3TFolIYco&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Excel &lt;/h2&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 222px" /&gt;&lt;col style="width: 516px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Topic&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/11/04/document-assembly-solution-for-spreadsheetml.aspx"&gt;&lt;strong&gt;Document Assembly Solution for SpreadsheetML&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to populate a spreadsheet with data from a real SQL database and create a cool looking chart based on that data.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/11/10/reading-data-from-spreadsheetml.aspx"&gt;&lt;strong&gt;Read Data from SpreadsheetML&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to read data from a spreadsheet and insert it into some data source, like a database.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/11/14/writing-semantically-aware-linq-queries-against-excel-tables.aspx"&gt;&lt;strong&gt;Writing Semantically Aware LINQ Queries Against Excel Tables&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to write a generic LINQ query that can work against any data source, including an Excel table. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/02/19/how-to-copy-a-worksheet-within-a-workbook.aspx"&gt;&lt;strong&gt;How to Copy a Worksheet within a Workbook&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to copy a worksheet within the same workbook. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/04/20/removing-comments-from-excel-and-powerpoint-files.aspx"&gt;&lt;strong&gt;Removing Comments from Excel and PowerPoint Files&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to remove comments from an Excel workbook. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;&lt;a href="http://blogs.msdn.com/b/brian_jones/archive/2010/05/27/parsing-and-reading-large-excel-files-with-the-open-xml-sdk.aspx"&gt;&lt;strong&gt;Read Large Excel Files using the Open XML SDK&lt;/strong&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;Learn how to use the SAX-like capabilities of the Open XML SDK to read very large Excel files. &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;PowerPoint &lt;/h2&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 222px" /&gt;&lt;col style="width: 516px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Topic&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/11/18/creating-a-presentation-report-based-on-data.aspx"&gt;&lt;strong&gt;Creating a Presentation Report Based on Data&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to create a rich presentation report based on data from a database. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/03/05/how-to-assemble-multiple-powerpoint-decks.aspx"&gt;&lt;strong&gt;How to Assemble Multiple PowerPoint Decks&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to merge multiple PowerPoint decks together. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/04/20/removing-comments-from-excel-and-powerpoint-files.aspx"&gt;&lt;strong&gt;Removing Comments from Excel and PowerPoint Files&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to remove comments from a PowerPoint deck. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/08/13/adding-repeating-data-to-powerpoint.aspx"&gt;&lt;strong&gt;Adding Repeating Data to PowerPoint&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to create repeating data within a table on a PowerPoint slide. &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/eT2ASswr0kA&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/eT2ASswr0kA&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Multiple Applications (Word, Excel, and PowerPoint) &lt;/h2&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 222px" /&gt;&lt;col style="width: 516px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Topic&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/03/13/importing-charts-from-spreadsheets-to-wordprocessing-documents.aspx"&gt;&lt;strong&gt;Importing Charts from Spreadsheets to Wordprocessing Documents&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to import a chart from a spreadsheet to a Word document. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/04/01/importing-a-table-from-wordprocessingml-to-spreadsheetml.aspx"&gt;&lt;strong&gt;Importing a Table from WordprocessingML to SpreadsheetML&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to import a table from a Wordprocessing document into a spreadsheet. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/06/04/importing-smartart-from-powerpoint-to-word.aspx"&gt;&lt;strong&gt;Importing SmartArt from PowerPoint to Word&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to import SmartArt from a PowerPoint deck into a Word document. &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/06/30/embedding-an-open-xml-file-in-another-open-xml-file.aspx"&gt;&lt;strong&gt;Embedding an Open XML File in another Open XML File&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to embed Open XML files within other Open XML documents. &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/xunFeqCW2GA&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/xunFeqCW2GA&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/07/21/embedding-any-file-type-like-pdf-in-an-open-xml-file.aspx"&gt;&lt;strong&gt;Embedding Any File Type, Like PDF, in an Open XML File&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to embed any file within Open XML documents. &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/qRzK035M4xI&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/qRzK035M4xI&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/08/03/the-open-xml-sdk-and-fluent-ui-extensibility.aspx"&gt;&lt;strong&gt;The Open XML SDK and Fluent UI Extensibility&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to add custom UI to a set of documents within a directory. &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/ci3J9w5iOIg&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/ci3J9w5iOIg&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2010/01/04/document-assembly-merging-excel-powerpoint-and-word-content-together.aspx"&gt;&lt;strong&gt;Document Assembly: Merging Excel, PowerPoint, and Word Content Together&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to take multiple Word, Excel and PowerPoint documents and merge them all together to form a final Word document. &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/abrjIFJHGhs&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/abrjIFJHGhs&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Office Services &lt;/h2&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 222px" /&gt;&lt;col style="width: 516px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Topic&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/12/03/extending-the-reach-of-excel-services-with-the-open-xml-sdk.aspx"&gt;&lt;strong&gt;Extending the Reach of Excel Services with the Open XML SDK&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to extend the reach of Excel Services and hosted charts to gather data from within a library of Word documents. &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/_oyF9-TRcAs&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/_oyF9-TRcAs&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2010/02/09/leveraging-the-power-of-word-automation-services-and-the-open-xml-sdk.aspx"&gt;&lt;strong&gt;Leveraging the Power of Word Automation Services and the Open XML SDK&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;Learn how to use Word Automation Services to update a table of contents of several documents have been merged with the Open XML SDK &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/exj_q4Yoxeo&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/exj_q4Yoxeo&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2010/02/26/open-xml-sdk-office-services-better-together.aspx"&gt;&lt;strong&gt;Open XML SDK + Office Services: Better Together&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;Learn how to leverage all three components, the SDK and the two Office services, to create a very cool mash up document assembly solution &lt;/p&gt;            &lt;p&gt;&lt;object width="480" height="385"&gt;                                 &lt;param name="movie" value="http://www.youtube.com/v/jz__Nwsecn4&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;                                 &lt;/param&gt;                                 &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;                                 &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;                                 &lt;embed src="http://www.youtube.com/v/jz__Nwsecn4&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Presentations &lt;/h2&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 197px" /&gt;&lt;col style="width: 441px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr style="background: #4f81bd"&gt;         &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Year + Conference + Session&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 1pt solid; padding-left: 7px; padding-right: 7px; border-top: #4f81bd 2.25pt solid"&gt;           &lt;p&gt;&lt;span style="color: white"&gt;&lt;strong&gt;Presentation&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://channel9.msdn.com/pdc2008/PC34"&gt;&lt;strong&gt;2008 PDC - Open XML Format SDK: Developing Open XML Solutions&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
                                width="980" height="498"&gt;                                 &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_18.xap" /&gt;                                 &lt;param name="initParams" value="deferredLoad=true,duration=0,m= http://mschnlnine.vo.llnwd.net/d1/pdc08/WMV-HQ/PC34.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://mschnlnine.vo.llnwd.net/d1/pdc08/THUMBNAILS/PC34.jpg, postid=426735" /&gt;                                 &lt;param name="background" value="#00FFFFFF" /&gt;                                 &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;                                     &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt;                                 &lt;/a&gt;                             &lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/office/ff436082.aspx"&gt;&lt;strong&gt;2009 SPC – Deep Dive Open XML and Open XML SDK&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;object type="application/x-silverlight" data="data:application/x-silverlight-2," width="560"
                                height="450"&gt;                                 &lt;param name="source" value="http://microsoftpdc.com/Skins/PDC09/Styles/players/VideoPlayer2009_03_27.xap" /&gt;                                 &lt;param name="initParams" value="m=http://zeyadrajabi.members.winisp.net/SPC14_402_OpenXMLDeepDive_Rajabi_1024.wmv,autostart=false, autohide=true,showembed=true, thumbnail=http://microsoftpdc.com/Skins/PDC09/Styles/images/DefaultPlayerBackground.png, postid=0" /&gt;                                 &lt;param name="background" value="#00FFFFFF" /&gt;                                &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;                                     &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt;                                 &lt;/a&gt;                             &lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td style="border-bottom: #4f81bd 2.25pt solid; padding-left: 7px; padding-right: 7px; border-top-style: none; border-left-style: none"&gt;           &lt;p&gt;&lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/11/23/open-xml-sdk-word-automation-services-presentation-at-pdc.aspx"&gt;&lt;strong&gt;2009 PDC – Open XML SDK + Office Services&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #4f81bd 2.25pt solid; border-right-style: none; padding-left: 7px; padding-right: 7px; border-top-style: none"&gt;           &lt;p&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
                                width="800" height="450"&gt;                                 &lt;param name="source" value="http://microsoftpdc.com/Skins/PDC09/Styles/players/VideoPlayer2009_03_27.xap" /&gt;                                 &lt;param name="initParams" value="m=http://ecn.channel9.msdn.com/o9/pdc09/wmvhigh/PR09.wmv,autostart=false, autohide=true,showembed=true, thumbnail=http://microsoftpdc.com/Skins/PDC09/Styles/images/DefaultPlayerBackground.png, postid=0" /&gt;                                 &lt;param name="background" value="#00FFFFFF" /&gt;                                 &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;                                     &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt;                                 &lt;/a&gt;                             &lt;/object&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Zeyad Rajabi&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9991283" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Table+of+Contents/">Table of Contents</category></item><item><title>Announcing the Release of the Open XML SDK 2.0</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/03/12/announcing-the-release-of-the-open-xml-sdk-2-0.aspx</link><pubDate>Fri, 12 Mar 2010 22:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9977809</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>16</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9977809</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/03/12/announcing-the-release-of-the-open-xml-sdk-2-0.aspx#comments</comments><description>&lt;P&gt;Today, I am really excited to announce the worldwide availability of the &lt;A href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0" mce_href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0"&gt;Open XML SDK 2.0 for Microsoft Office&lt;/A&gt;! The Open XML SDK plays an integral part in creating Office document solutions that work on the client or server. The Open XML SDK allows you to create, consume, and manipulate Open XML files without needing to automate Office client applications. &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx"&gt;Combining the power of Office Services and the Open XML SDK&lt;/A&gt; enables even more scenarios, such as rich server-side document assembly solutions. Using the Open XML SDK and Office Services, you now have an alternative for many of the scenarios where previously you would have run into one of Office's most popular knowledge base articles that talks about how automating Office client applications on the server is not supported (&lt;A href="http://support.microsoft.com/kb/257757" mce_href="http://support.microsoft.com/kb/257757"&gt;http://support.microsoft.com/kb/257757&lt;/A&gt;). &lt;/P&gt;
&lt;P&gt;Development of the Open XML SDK 2.0 spanned almost two years and involved the release of four Technical Previews in addition to the final release announced today. Your feedback via the blogs, &lt;A href="http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/threads" mce_href="http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/threads"&gt;MSDN forums&lt;/A&gt;, &lt;A href="http://www.openxmldeveloper.com/" mce_href="http://www.openxmldeveloper.com"&gt;www.openxmldeveloper.com&lt;/A&gt; forums, and Microsoft Connect &lt;A href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=589" mce_href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=589"&gt;site&lt;/A&gt; helped shape the overall design of the SDK. Thank you so much for your support and feedback! Please feel free to continue sending us feedback with respect to the Open XML SDK. &lt;/P&gt;
&lt;H2&gt;Download the SDK &lt;/H2&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=761&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 84px"&gt;
&lt;COL style="WIDTH: 540px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=96&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheOpenXMLSDK2.0_D1ED/image.png" mce_href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheOpenXMLSDK2.0_D1ED/image.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheOpenXMLSDK2.0_D1ED/image_thumb.png" width=79 height=79 mce_src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheOpenXMLSDK2.0_D1ED/image_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD width=663&gt;&lt;BR&gt;&lt;BR&gt;
&lt;P&gt;&lt;STRONG&gt;Download the Open XML SDK 2.0 for Microsoft Office&lt;/STRONG&gt; &lt;BR&gt;This download provides strongly typed part and content classes for use with Office 2007 &amp;amp; Office 2010 Open XML documents. &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;H3&gt;Release Notes &lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;Open XML SDK 2.0 is freely redistributable by any solution provider implementing the formats &lt;/LI&gt;
&lt;LI&gt;Office applications are not required to use the Open XML SDK 2.0, and no software purchase is required. Developers can freely use the Open XML SDK to build document processing solutions for Microsoft Office files and for other implementations of the IS29500 standard &lt;/LI&gt;&lt;/UL&gt;
&lt;H2&gt;Learn More about the Open XML SDK &lt;/H2&gt;
&lt;P&gt;Over the past year and a half, I have shown you guys a lot of &lt;A href="http://blogs.msdn.com/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/default.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/default.aspx"&gt;real world scenarios/solutions that are built with the SDK&lt;/A&gt;. Here is a summary of links that will help you learn more about the Open XML SDK:&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;STRONG&gt;MSDN &lt;/STRONG&gt;&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;A href="http://msdn.microsoft.com/en-us/office/bb265236.aspx" mce_href="http://msdn.microsoft.com/en-us/office/bb265236.aspx"&gt;Open XML Developer Center&lt;/A&gt; &lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;This site is your one-stop shop for finding all information related to Open XML and the Open XML SDK &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/office/default.aspx" mce_href="http://msdn.microsoft.com/en-us/office/default.aspx"&gt;Office Developer Center&lt;/A&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/office/ee396255.aspx" mce_href="http://msdn.microsoft.com/en-us/office/ee396255.aspx"&gt;Office Visual-How-To sites&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb448854(office.14).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb448854(office.14).aspx"&gt;An overview of Open XML SDK 2.0 for Microsoft Office&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd608815(office.14).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd608815(office.14).aspx"&gt;Class Library References&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/cc313105.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc313105.aspx"&gt;Microsoft Office File Format Documents&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;STRONG&gt;YouTube Videos&lt;/STRONG&gt; &lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=KSSMLR19JWA" mce_href="http://www.youtube.com/watch?v=KSSMLR19JWA"&gt;The Open XML SDK Productivity Tool&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=eT2ASswr0kA&amp;amp;feature=channel" mce_href="http://www.youtube.com/watch?v=eT2ASswr0kA&amp;amp;feature=channel"&gt;Using the Open XML SDK to add repeating data to a PowerPoint Deck&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=xunFeqCW2GA&amp;amp;feature=channel" mce_href="http://www.youtube.com/watch?v=xunFeqCW2GA&amp;amp;feature=channel"&gt;Programmatically embedding an Excel spreadsheet into a Word document&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=exj_q4Yoxeo&amp;amp;feature=related" mce_href="http://www.youtube.com/watch?v=exj_q4Yoxeo&amp;amp;feature=related"&gt;Leveraging the Power of Word Automation Services and the Open XML SDK&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=abrjIFJHGhs&amp;amp;feature=channel" mce_href="http://www.youtube.com/watch?v=abrjIFJHGhs&amp;amp;feature=channel"&gt;Document Assembly: Merging Excel, PowerPoint, and Word Content Together&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=_oyF9-TRcAs&amp;amp;feature=channel" mce_href="http://www.youtube.com/watch?v=_oyF9-TRcAs&amp;amp;feature=channel"&gt;Extending the Reach of Excel Services with the Open XML SDK&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=jz__Nwsecn4&amp;amp;feature=channel" mce_href="http://www.youtube.com/watch?v=jz__Nwsecn4&amp;amp;feature=channel"&gt;Open XML SDK + Office Services: Better Together&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=ci3J9w5iOIg&amp;amp;feature=channel" mce_href="http://www.youtube.com/watch?v=ci3J9w5iOIg&amp;amp;feature=channel"&gt;Add Custom UI to Word Documents with the Open XML SDK&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=qRzK035M4xI&amp;amp;feature=channel" mce_href="http://www.youtube.com/watch?v=qRzK035M4xI&amp;amp;feature=channel"&gt;Programmatically Embedding a PDF into a Word Document&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=250o8kMvjy4&amp;amp;feature=channel" mce_href="http://www.youtube.com/watch?v=250o8kMvjy4&amp;amp;feature=channel"&gt;Import SmartArt From Ppt To Word&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.youtube.com/watch?v=yA3TFolIYco&amp;amp;feature=channel" mce_href="http://www.youtube.com/watch?v=yA3TFolIYco&amp;amp;feature=channel"&gt;Retrieve Word Content Based on Styles&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;STRONG&gt;Forum &amp;amp; Blogs&lt;/STRONG&gt; &lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://openxmldeveloper.org/" mce_href="http://openxmldeveloper.org/"&gt;http://openxmldeveloper.org/&lt;/A&gt; - A place to learn and share more about Open XML Formats, news, information, and getting questions answered &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/threads/?prof=required" mce_href="http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/threads/?prof=required"&gt;http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk&lt;/A&gt; - A discussion forum for developer topics related to the Open XML Format SDK &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/ericwhite/" mce_href="http://blogs.msdn.com/ericwhite/"&gt;http://blogs.msdn.com/ericwhite/&lt;/A&gt;&lt;SPAN style="TEXT-DECORATION: underline"&gt; &lt;/SPAN&gt;- Eric White's blog that focuses on Open XML and SharePoint development. This blog contains a lot of rich information on the Open XML file formats as well as sample code related to the Open XML SDK &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;STRONG&gt;Conference Presentations &lt;/STRONG&gt;&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/11/23/open-xml-sdk-word-automation-services-presentation-at-pdc.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/11/23/open-xml-sdk-word-automation-services-presentation-at-pdc.aspx"&gt;Open XML SDK + Office Services Presentation at PDC&lt;/A&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/office/ff436082.aspx" mce_href="http://msdn.microsoft.com/en-us/office/ff436082.aspx"&gt;Deep Dive Open XML and the Open XML SDK Presentation at SPC&lt;/A&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;In a future post I will outline the improvements we made to the Open XML SDK 2.0 compared to the &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/12/14/announcing-the-release-of-the-december-2009-ctp-for-the-open-xml-sdk.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/12/14/announcing-the-release-of-the-december-2009-ctp-for-the-open-xml-sdk.aspx"&gt;December 2009 CTP&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;Zeyad Rajabi&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9977809" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2007/">Office 2007</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Open XML SDK + Office Services: Better Together</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/02/26/open-xml-sdk-office-services-better-together.aspx</link><pubDate>Fri, 26 Feb 2010 21:35:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9970153</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9970153</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/02/26/open-xml-sdk-office-services-better-together.aspx#comments</comments><description>&lt;p&gt;I am probably starting to sound like a broken record, but I am really excited about the different types of solutions that are possible when combining the Open XML SDK with Office Services. In the past, I showed you how to leverage the Open XML SDK to accomplish three main scenarios: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Push data into Open XML files &lt;/li&gt;    &lt;li&gt;Pull data out of Open XML files &lt;/li&gt;    &lt;li&gt;Manipulate Open XML files &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;In a &lt;a href="http://blogs.msdn.com/brian_jones/archive/2010/02/09/leveraging-the-power-of-word-automation-services-and-the-open-xml-sdk.aspx"&gt;previous post&lt;/a&gt;, I showed you how to use &lt;a href="http://blogs.msdn.com/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx"&gt;Word Automation Services&lt;/a&gt; to update fields, such as a table of contents, within a document. Today, I am going to show you another functionality of Word Automation Services that will allow you to perform file format conversions on the server. For example, you can leverage the service to convert Word documents into PDF. In addition to Word Automation Services, I am going to show you how to leverage &lt;a href="http://blogs.msdn.com/excel/archive/2009/10/21/more-updates-from-spc.aspx"&gt;Excel Services&lt;/a&gt; to recalculate charts and formulas within a workbook. &lt;/p&gt;  &lt;p&gt;In today's post, I am going to show you how to leverage all three components, the SDK and the two Office services, to create a very cool mash up document assembly solution. &lt;/p&gt;  &lt;p&gt;If you want to jump straight into the code, feel free to download the solution &lt;a href="http://zeyadrajabi.members.winisp.net/sourcecode/WordExcelServicesDemo.zip"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;object width="425" height="344"&gt;             &lt;param name="movie" value="http://www.youtube.com/v/jz__Nwsecn4&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;/param&gt;             &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;             &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;             &lt;embed src="http://www.youtube.com/v/jz__Nwsecn4&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;  &lt;h2&gt;Scenario &lt;/h2&gt;  &lt;p&gt;Imagine a scenario where I am working for a company that deals with mortgages. One of the services our company provides is creating custom mortgage reports for customers wishing to take out a loan. These reports include rich information and charts that are specific to the customer's mortgage specifics, such as mortgage amount, number of years of the mortgage, and interest rate of the loan. My company uses Excel workbooks to calculate the different financial and mortgage calculation models. In fact, for the sake of this blog post we will use the same workbook mentioned in this &lt;a href="http://blogs.msdn.com/excel/archive/2005/11/21/495454.aspx"&gt;post on the Excel team blog&lt;/a&gt;. My company has asked me to create a server-side solution that is able to leverage the Excel workbook that contains the mortgage calculation model and generate a customer ready PDF report, which contains rich content, such as charts and data pulled in from the workbook. &lt;/p&gt;  &lt;h2&gt;Solution &lt;/h2&gt;  &lt;p&gt;The scenario described above is very similar to the scenario described by Brian Jones in his post that first talked about combining &lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx"&gt;Open XML and Office Services&lt;/a&gt;. To accomplish this scenario we will need to take the following actions: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create an Excel workbook that represents the company's mortgage calculation model &lt;/li&gt;    &lt;li&gt;Create a Word document that represents the look and feel of the final report. This document will contain &lt;a href="http://blogs.msdn.com/microsoft_office_word/archive/2006/11/17/meet-the-controls.aspx"&gt;content controls&lt;/a&gt; to demarcate regions where content and data will be merged &lt;/li&gt;    &lt;li&gt;Create a web part for SharePoint that includes three text fields, which will allow users to input a loan amount, number of years of the loan, and interest rate, and a button, which will allow users to generate the final mortgage report in PDF format &lt;/li&gt;    &lt;li&gt;Using the Open XML SDK, open the Excel workbook, which contains the mortgage calculation model, and inject the values specified within the three text fields &lt;/li&gt;    &lt;li&gt;Leverage Excel Services to recalculate the Excel workbook &lt;/li&gt;    &lt;li&gt;Use the Open XML SDK to pull data and content from the recalculated Excel workbook and push the content into the Word template document &lt;/li&gt;    &lt;li&gt;Leverage Word Automation Services to convert the Word document into a PDF &lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Step 1 &amp;amp; 2 – Creating the Right Excel and Word Templates &lt;/h2&gt;  &lt;p&gt;The right template makes all the difference when creating Office document solutions. The Excel workbook that contains the mortgage calculation model requires three values to perform calculations: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Mortgage amount &lt;/li&gt;    &lt;li&gt;Term (years) &lt;/li&gt;    &lt;li&gt;Fixed interest rate &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;In order to make it easy to insert these three values into the workbook, I am going to leverage Defined Names. Defined Names provides a mechanism to demarcate one or more cells in a workbook, which makes it really easy to find content and regions within workbooks. Here is a screenshot of my Excel workbook template: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/OpenXMLSDKOfficeServicesBetterTogether_C065/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/OpenXMLSDKOfficeServicesBetterTogether_C065/image_thumb.png" width="903" height="690" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Notice that this workbook contains pretty rich formulas in order to calculate monthly payments and rich charts. &lt;/p&gt;  &lt;p&gt;The Word template document that represents the look and feel of the final report looks pretty similar to other templates I've shown you in the past that leverage content controls. Here is a screenshot of my Word document template: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/OpenXMLSDKOfficeServicesBetterTogether_C065/image_3.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/OpenXMLSDKOfficeServicesBetterTogether_C065/image_thumb_3.png" width="699" height="792" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;You can find these two template files &lt;a href="http://zeyadrajabi.members.winisp.net/sourcecode/Mortgages.zip"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;h2&gt;Step 3 – Create a Web Part with a Button Command and Text Fields &lt;/h2&gt;  &lt;p&gt;Our end goal is to create a Web Part that contains three textboxes and a button command that will look like the following: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/OpenXMLSDKOfficeServicesBetterTogether_C065/image_4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/OpenXMLSDKOfficeServicesBetterTogether_C065/image_thumb_4.png" width="249" height="138" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The easiest way to accomplish this task is to create a Web Part within &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;Visual Studio 2010&lt;/a&gt;. We can create a user control ascx page that represents our web part with the following code: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 821px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="background-color: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Assembly&lt;/span&gt; &lt;span style="color: red"&gt;Name&lt;span style="color: blue"&gt;=&amp;quot;$SharePoint.Project.AssemblyFullName$&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="background-color: yellow"&gt;%&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="background-color: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Assembly&lt;/span&gt; &lt;span style="color: red"&gt;Name&lt;span style="color: blue"&gt;=&amp;quot;Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="background-color: yellow"&gt;%&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="background-color: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Register&lt;/span&gt; &lt;span style="color: red"&gt;Tagprefix&lt;span style="color: blue"&gt;=&amp;quot;SharePoint&amp;quot;&lt;/span&gt; Namespace&lt;span style="color: blue"&gt;=&amp;quot;Microsoft.SharePoint.WebControls&amp;quot;&lt;/span&gt; Assembly&lt;span style="color: blue"&gt;=&amp;quot;Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="background-color: yellow"&gt;%&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="background-color: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Register&lt;/span&gt; &lt;span style="color: red"&gt;Tagprefix&lt;span style="color: blue"&gt;=&amp;quot;Utilities&amp;quot;&lt;/span&gt; Namespace&lt;span style="color: blue"&gt;=&amp;quot;Microsoft.SharePoint.Utilities&amp;quot;&lt;/span&gt; Assembly&lt;span style="color: blue"&gt;=&amp;quot;Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="background-color: yellow"&gt;%&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="background-color: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Register&lt;/span&gt; &lt;span style="color: red"&gt;Tagprefix&lt;span style="color: blue"&gt;=&amp;quot;asp&amp;quot;&lt;/span&gt; Namespace&lt;span style="color: blue"&gt;=&amp;quot;System.Web.UI&amp;quot;&lt;/span&gt; Assembly&lt;span style="color: blue"&gt;=&amp;quot;System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="background-color: yellow"&gt;%&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="background-color: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Import&lt;/span&gt; &lt;span style="color: red"&gt;Namespace&lt;span style="color: blue"&gt;=&amp;quot;Microsoft.SharePoint&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="background-color: yellow"&gt;%&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="background-color: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Register&lt;/span&gt; &lt;span style="color: red"&gt;Tagprefix&lt;span style="color: blue"&gt;=&amp;quot;WebPartPages&amp;quot;&lt;/span&gt; Namespace&lt;span style="color: blue"&gt;=&amp;quot;Microsoft.SharePoint.WebPartPages&amp;quot;&lt;/span&gt; Assembly&lt;span style="color: blue"&gt;=&amp;quot;Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="background-color: yellow"&gt;%&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="background-color: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@&lt;/span&gt; &lt;span style="color: maroon"&gt;Control&lt;/span&gt; &lt;span style="color: red"&gt;Language&lt;span style="color: blue"&gt;=&amp;quot;C#&amp;quot;&lt;/span&gt; AutoEventWireup&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; CodeBehind&lt;span style="color: blue"&gt;=&amp;quot;VisualWebPart1UserControl.ascx.cs&amp;quot;&lt;/span&gt; Inherits&lt;span style="color: blue"&gt;=&amp;quot;WordExcelServicesDemo.VisualWebPart1.VisualWebPart1UserControl&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;span style="background-color: yellow"&gt;%&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;style&lt;/span&gt; &lt;span style="color: red"&gt;type&lt;span style="color: blue"&gt;=&amp;quot;text/css&amp;quot;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.style1 &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;width: 235px; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;style&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;table&lt;/span&gt; &lt;span style="color: red"&gt;class&lt;span style="color: blue"&gt;=&amp;quot;style1&amp;quot;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;tr&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Amount:&lt;span style="color: blue"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;asp&lt;span style="color: blue"&gt;:&lt;span style="color: maroon"&gt;TextBox&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;span style="color: blue"&gt;=&amp;quot;AmountTextBox&amp;quot;&lt;/span&gt; runat&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/&lt;span style="color: maroon"&gt;asp&lt;span style="color: blue"&gt;:&lt;span style="color: maroon"&gt;TextBox&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;tr&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;tr&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Term (Years):&lt;span style="color: blue"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;asp&lt;span style="color: blue"&gt;:&lt;span style="color: maroon"&gt;TextBox&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;span style="color: blue"&gt;=&amp;quot;YearsTextBox&amp;quot;&lt;/span&gt; runat&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/&lt;span style="color: maroon"&gt;asp&lt;span style="color: blue"&gt;:&lt;span style="color: maroon"&gt;TextBox&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;tr&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;tr&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Interest:&lt;span style="color: blue"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;asp&lt;span style="color: blue"&gt;:&lt;span style="color: maroon"&gt;TextBox&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;span style="color: blue"&gt;=&amp;quot;InterestTextBox&amp;quot;&lt;/span&gt; runat&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/&lt;span style="color: maroon"&gt;asp&lt;span style="color: blue"&gt;:&lt;span style="color: maroon"&gt;TextBox&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;td&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;tr&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;/&lt;span style="color: maroon"&gt;table&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9pt"&gt;&amp;lt;&lt;span style="color: maroon"&gt;asp&lt;span style="color: blue"&gt;:&lt;span style="color: maroon"&gt;Button&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;span style="color: blue"&gt;=&amp;quot;Button1&amp;quot;&lt;/span&gt; runat&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; onclick&lt;span style="color: blue"&gt;=&amp;quot;Button1_Click&amp;quot;&lt;/span&gt; Text&lt;span style="color: blue"&gt;=&amp;quot;Generate Report&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;The code behind this ascx page will contain functionality behind the Generate Report button command: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 821px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;partial&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;VisualWebPart1UserControl&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;UserControl&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Button1_Click(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;//Code to perform pushing/pulling/generating of data/content&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;So now we're ready to add the Open XML SDK and Office Services code. For the sake of this solution I am going to add my two template documents within a specific templates directory within my SharePoint library called &amp;quot;Excel Template&amp;quot;. &lt;/p&gt;  &lt;h2&gt;Step 4 – Add Data to Excel Workbook &lt;/h2&gt;  &lt;p&gt;This step is all about inserting data into specific regions within our Excel workbook. I am going to leverage a couple of &lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/09/17/open-xml-sdk-code-snippets.aspx"&gt;Open XML SDK code snippets&lt;/a&gt; to help out with this task. Specifically, I am going to reuse the following snippets: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;XLGetWorksheetPartByName&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;InsertCellInWorksheet&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here is the code necessary to push data into specific regions of an Excel workbook: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 821px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Button1_Click(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPWeb&lt;/span&gt; myWebSite = &lt;span style="color: #2b91af"&gt;SPContext&lt;/span&gt;.Current.Web; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; outputExcelFilename = myWebSite.Url + &lt;span style="color: #a31515"&gt;@&amp;quot;/Shared%20Documents/output.xlsx&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; outputWordFilename = myWebSite.Url + &lt;span style="color: #a31515"&gt;@&amp;quot;/Shared%20Documents/output.docx&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; amountTxBx = AmountTextBox.Text; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; interestTxBx = InterestTextBox.Text; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; termTxBx = YearsTextBox.Text; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (amountTxBx == &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;amountTxBx = &lt;span style="color: #a31515"&gt;&amp;quot;200000&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (interestTxBx == &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;interestTxBx = &lt;span style="color: #a31515"&gt;&amp;quot;.09&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (termTxBx == &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;termTxBx = &lt;span style="color: #a31515"&gt;&amp;quot;30&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;//Copy templates&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPWeb&lt;/span&gt; myWebsite = &lt;span style="color: #2b91af"&gt;SPContext&lt;/span&gt;.Current.Web; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPFile&lt;/span&gt; templateExcelFile = myWebsite.GetFile(myWebSite.Url + &lt;span style="color: #a31515"&gt;@&amp;quot;/Excel%20Template/Mortgages.xlsx&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;templateExcelFile.CopyTo(outputExcelFilename, &lt;span style="color: blue"&gt;true&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPFile&lt;/span&gt; templateWordFile = myWebsite.GetFile(myWebSite.Url + &lt;span style="color: #a31515"&gt;@&amp;quot;/Excel%20Template/Template.docx&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;templateWordFile.CopyTo(outputWordFilename, &lt;span style="color: blue"&gt;true&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;//Update Excel output file&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPFile&lt;/span&gt; outputExcel = myWebsite.GetFile(outputExcelFilename); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;byte&lt;/span&gt;[] byteArray = outputExcel.OpenBinary(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt; mem = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;mem.Write(byteArray, &lt;span style="color: brown"&gt;0&lt;/span&gt;, (&lt;span style="color: blue"&gt;int&lt;/span&gt;)byteArray.Length); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt; spreadsheetDocument = &lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt;.Open(mem, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; sheet1 = XLGetWorksheetPartByName(spreadsheetDocument, &lt;span style="color: #a31515"&gt;&amp;quot;Sheet1&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;AddCellValues(sheet1, amountTxBx, interestTxBx, termTxBx); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;outputExcel.SaveBinary(mem); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; AddCellValues(&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; sheetPart, &lt;span style="color: blue"&gt;string&lt;/span&gt; amount, &lt;span style="color: blue"&gt;string&lt;/span&gt; interest, &lt;span style="color: blue"&gt;string&lt;/span&gt; term) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; color: green; font-size: 9pt"&gt;/* &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; color: green; font-size: 9pt"&gt;I am going to cheat a bit here and not calculate the Column/Row index of the defined names (You can look &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/11/10/reading-data-from-spreadsheetml.aspx"&gt;http://blogs.msdn.com/brian_jones/archive/2008/11/10/reading-data-from-spreadsheetml.aspx&lt;/a&gt; for more information on how to accomplish this task &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;&amp;lt;definedName name=&amp;quot;AMOUNT&amp;quot;&amp;gt;Sheet1!$A$2&amp;lt;/definedName&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;&amp;lt;definedName name=&amp;quot;FIR&amp;quot;&amp;gt;Sheet1!$A$8&amp;lt;/definedName&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;&amp;lt;definedName name=&amp;quot;TERM&amp;quot;&amp;gt;Sheet1!$A$5&amp;lt;/definedName&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;* */&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Excel.&lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt; cell = InsertCellInWorksheet(sheetPart.Worksheet, &lt;span style="color: #a31515"&gt;&amp;quot;A2&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;cell.CellValue.Text = amount; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;cell = InsertCellInWorksheet(sheetPart.Worksheet, &lt;span style="color: #a31515"&gt;&amp;quot;A5&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;cell.CellValue.Text = term; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;cell = InsertCellInWorksheet(sheetPart.Worksheet, &lt;span style="color: #a31515"&gt;&amp;quot;A8&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;cell.CellValue.Text = interest; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Step 5 – Recalculate Workbook using Excel Services &lt;/h2&gt;  &lt;p&gt;Step 4 helped push data into the Excel workbook. Our next task is to recalculate the workbook. This task is pretty easy to do with Excel Services: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 821px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Button1_Click(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;//RECALC workbook&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;ExcelService&lt;/span&gt; es = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ExcelService&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;Status&lt;/span&gt;[] status; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; sessionId = es.OpenWorkbookForEditing(outputExcelFilename, &lt;span style="color: #a31515"&gt;&amp;quot;en-US&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;en-US&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;out&lt;/span&gt; status); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;es.CalculateWorkbook(sessionId, &lt;span style="color: #2b91af"&gt;CalculateType&lt;/span&gt;.CalculateFull, &lt;span style="color: blue"&gt;out&lt;/span&gt; status); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;es.SaveWorkbook(sessionId, &lt;span style="color: blue"&gt;out&lt;/span&gt; status); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;es.CloseWorkbook(sessionId, &lt;span style="color: blue"&gt;out&lt;/span&gt; status); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Step 6 – merge Excel Content Data into Word Document &lt;/h2&gt;  &lt;p&gt;I've shown this step a number of times in previous blog posts. For this task I am going to leverage the following Open XML SDK code snippets: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;XLGetWorksheetPartByName &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;WDGetContentControl &lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;XLGetCellValueRowCol &lt;/span&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here is the necessary code to accomplish this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 851px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Button1_Click(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;outputExcel = myWebsite.GetFile(outputExcelFilename); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;byte&lt;/span&gt;[] byteArrayExcel = outputExcel.OpenBinary(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt; memExcel = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;memExcel.Write(byteArrayExcel, &lt;span style="color: brown"&gt;0&lt;/span&gt;, (&lt;span style="color: blue"&gt;int&lt;/span&gt;)byteArrayExcel.Length); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt; spreadsheetDocument = &lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt;.Open(memExcel, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;WorkbookPart&lt;/span&gt; wbPart = spreadsheetDocument.WorkbookPart; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; sheet1 = XLGetWorksheetPartByName(spreadsheetDocument, &lt;span style="color: #a31515"&gt;&amp;quot;Sheet1&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; sheet2 = XLGetWorksheetPartByName(spreadsheetDocument, &lt;span style="color: #a31515"&gt;&amp;quot;Sheet2&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPFile&lt;/span&gt; outputWord = myWebsite.GetFile(outputWordFilename); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;byte&lt;/span&gt;[] byteArrayWord = outputWord.OpenBinary(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt; memWord = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;memWord.Write(byteArrayWord, &lt;span style="color: brown"&gt;0&lt;/span&gt;, (&lt;span style="color: blue"&gt;int&lt;/span&gt;)byteArrayWord.Length); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt; myDoc = &lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt;.Open(memWord, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;MainDocumentPart&lt;/span&gt; mainPart = myDoc.MainDocumentPart; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;SdtElement&lt;/span&gt; monthlyPaymentsChartSdt = WDGetContentControl(mainPart, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #a31515"&gt;&amp;quot;MonthlyPaymentsChart&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;ImportChartFromSpreadsheet(mainPart, monthlyPaymentsChartSdt, sheet2, &lt;span style="color: #a31515"&gt;&amp;quot;rId2&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;SdtElement&lt;/span&gt; totalPaymentsChartSdt = WDGetContentControl(mainPart, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #a31515"&gt;&amp;quot;TotalPaymentsChart&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;ImportChartFromSpreadsheet(mainPart, totalPaymentsChartSdt, sheet2, &lt;span style="color: #a31515"&gt;&amp;quot;rId1&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;SdtElement&lt;/span&gt; interestRateChartSdt = WDGetContentControl(mainPart, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #a31515"&gt;&amp;quot;PaymentsInterestRateChart&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;ImportChartFromSpreadsheet(mainPart, interestRateChartSdt, sheet1, &lt;span style="color: #a31515"&gt;&amp;quot;rId1&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;SdtElement&lt;/span&gt; mortgageAmountSdt = WDGetContentControl(mainPart, &lt;span style="color: #a31515"&gt;&amp;quot;MortgageAmount&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;AddTextToSdt(mainPart, mortgageAmountSdt, &lt;span style="color: #a31515"&gt;&amp;quot;$&amp;quot;&lt;/span&gt; + XLGetCellValueRowCol(wbPart, sheet1, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #a31515"&gt;&amp;quot;A&amp;quot;&lt;/span&gt;, &lt;span style="color: brown"&gt;2&lt;/span&gt;)); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;SdtElement&lt;/span&gt; termSdt = WDGetContentControl(mainPart, &lt;span style="color: #a31515"&gt;&amp;quot;Term&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;AddTextToSdt(mainPart, termSdt, XLGetCellValueRowCol(wbPart, sheet1, &lt;span style="color: #a31515"&gt;&amp;quot;A&amp;quot;&lt;/span&gt;, &lt;span style="color: brown"&gt;5&lt;/span&gt;)); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;SdtElement&lt;/span&gt; interestRateSdt = WDGetContentControl(mainPart, &lt;span style="color: #a31515"&gt;&amp;quot;InterestRate&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;AddTextToSdt(mainPart, interestRateSdt, XLGetCellValueRowCol(wbPart, sheet1, &lt;span style="color: #a31515"&gt;&amp;quot;A&amp;quot;&lt;/span&gt;, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: brown"&gt;8&lt;/span&gt;)); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;SdtElement&lt;/span&gt; monthlyPaymentSdt = WDGetContentControl(mainPart, &lt;span style="color: #a31515"&gt;&amp;quot;MonthlyPayment&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; amount = XLGetCellValueRowCol(wbPart, sheet1, &lt;span style="color: #a31515"&gt;&amp;quot;B&amp;quot;&lt;/span&gt;, &lt;span style="color: brown"&gt;11&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;decimal&lt;/span&gt; decAmount; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;Decimal&lt;/span&gt;.TryParse(amount, &lt;span style="color: blue"&gt;out&lt;/span&gt; decAmount); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;decAmount = &lt;span style="color: #2b91af"&gt;Math&lt;/span&gt;.Round(decAmount, &lt;span style="color: brown"&gt;2&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;AddTextToSdt(mainPart, monthlyPaymentSdt, &lt;span style="color: #a31515"&gt;&amp;quot;$&amp;quot;&lt;/span&gt; + decAmount); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;SdtElement&lt;/span&gt; paymentTableSdt = WDGetContentControl(mainPart, &lt;span style="color: #a31515"&gt;&amp;quot;PaymentTable&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;ImportTableFromSpreadsheet(mainPart, paymentTableSdt, wbPart, sheet2, &lt;span style="color: brown"&gt;3&lt;/span&gt;, &lt;span style="color: brown"&gt;17&lt;/span&gt;, &lt;span style="color: brown"&gt;10&lt;/span&gt;, &lt;span style="color: brown"&gt;50&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;outputWord.SaveBinary(memWord); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; AddTextToSdt(&lt;span style="color: #2b91af"&gt;MainDocumentPart&lt;/span&gt; mainPart, Word.&lt;span style="color: #2b91af"&gt;SdtElement&lt;/span&gt; sdt, &lt;span style="color: blue"&gt;string&lt;/span&gt; text) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;sdt.SdtProperties.RemoveAllChildren&amp;lt;Word.&lt;span style="color: #2b91af"&gt;SdtPlaceholder&lt;/span&gt;&amp;gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;Paragraph&lt;/span&gt; oldP = sdt.Descendants&amp;lt;Word.&lt;span style="color: #2b91af"&gt;Paragraph&lt;/span&gt;&amp;gt;().First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Word.&lt;span style="color: #2b91af"&gt;Paragraph&lt;/span&gt; p = &lt;span style="color: blue"&gt;new&lt;/span&gt; Word.&lt;span style="color: #2b91af"&gt;Paragraph&lt;/span&gt;( &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; Word.&lt;span style="color: #2b91af"&gt;Run&lt;/span&gt;( &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; Word.&lt;span style="color: #2b91af"&gt;Text&lt;/span&gt;(text))); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;OpenXmlElement&lt;/span&gt; parent = oldP.Parent; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;parent.ReplaceChild&amp;lt;Word.&lt;span style="color: #2b91af"&gt;Paragraph&lt;/span&gt;&amp;gt;(p, oldP); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;One method I am not going to show in this post is how to import a table from a spreadsheet into a Word document since I've already showed you how to accomplish this task in my previous post showing you how to &lt;a href="http://blogs.msdn.com/brian_jones/archive/2010/01/04/document-assembly-merging-excel-powerpoint-and-word-content-together.aspx"&gt;merge Excel, PowerPoint, and Word content together&lt;/a&gt;. &lt;/p&gt;  &lt;h2&gt;Step 7 – Convert Word Document into PDF &lt;/h2&gt;  &lt;p&gt;Our last step is to convert our Word document into PDF. This task is really easy to accomplish with Word Automation Services. Here is the necessary code to accomplish this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 821px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Button1_Click(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;ConversionJob&lt;/span&gt; pdfJob = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ConversionJob&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Word Automation Services&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;pdfJob.Name = &lt;span style="color: #a31515"&gt;&amp;quot;Mortgage Report&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;pdfJob.UserToken = myWebsite.CurrentUser.UserToken; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;pdfJob.AddFile(outputWordFilename, outputWordFilename.Replace(&lt;span style="color: #a31515"&gt;&amp;quot;.docx&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;.pdf&amp;quot;&lt;/span&gt;)); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;pdfJob.Start(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;Only five lines of code! &lt;/p&gt;  &lt;h2&gt;End Result &lt;/h2&gt;  &lt;p&gt;Putting everything together and running the code we end up with a PDF that contains all the content from our Word and Excel documents: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/OpenXMLSDKOfficeServicesBetterTogether_C065/image_5.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/OpenXMLSDKOfficeServicesBetterTogether_C065/image_thumb_5.png" width="1137" height="874" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Zeyad&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9970153" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Word/">Word</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Excel/">Excel</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Office Developer Atlas</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/02/16/office-developer-atlas.aspx</link><pubDate>Wed, 17 Feb 2010 00:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9964735</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9964735</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/02/16/office-developer-atlas.aspx#comments</comments><description>&lt;P&gt;&lt;A href="http://blogs.msdn.com/johnrdurant/" mce_href="http://blogs.msdn.com/johnrdurant/"&gt;John Durant&lt;/A&gt; just announced a new interactive developer training tool, based on Silverlight, called &lt;A href="http://www.microsoft.com/resources/msdn/en-us/office/media/Atlas/Default.html" mce_href="http://www.microsoft.com/resources/msdn/en-us/office/media/Atlas/Default.html"&gt;Office Developer Atlas&lt;/A&gt;. This tool is a great starting point for learning how to develop Office solutions. The current version of the tool concentrates on the following: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Building solutions with VBA (Visual Basic for Applications) &lt;/LI&gt;
&lt;LI&gt;Customizing the Ribbon Fluent UI &lt;/LI&gt;
&lt;LI&gt;Customizing the &lt;A href="http://blogs.technet.com/office2010/archive/2009/08/17/evolving-the-backstage-view.aspx" mce_href="http://blogs.technet.com/office2010/archive/2009/08/17/evolving-the-backstage-view.aspx"&gt;Office 2010 Backstage View&lt;/A&gt; &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Let John or I know if you have requests for other modules in the training environment. &lt;/P&gt;
&lt;P&gt;Zeyad&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9964735" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Leveraging the Power of Word Automation Services and the Open XML SDK</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/02/09/leveraging-the-power-of-word-automation-services-and-the-open-xml-sdk.aspx</link><pubDate>Tue, 09 Feb 2010 21:58:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9960801</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9960801</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/02/09/leveraging-the-power-of-word-automation-services-and-the-open-xml-sdk.aspx#comments</comments><description>&lt;p&gt;Have you ever wanted to update page number fields or a table of contents within Word documents on the server? The Open XML SDK provides functionality that allows you to easily add or remove content within a Word document. However, as mentioned in the &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/10/06/open-xml-format-sdk-2-0.aspx"&gt;announcement of the Open XML SDK 2.0&lt;/a&gt;, the SDK does not provide runtime application behaviors such as layout and recalculation. In order to recalculate a table of contents you need to run some kind of layout engine in order to properly determine pages within a document. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx"&gt;Word Automation Services&lt;/a&gt; is designed to handle tasks that require application logic, such as file conversion and layout. As Brian mentioned in a previous post, &lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx"&gt;Open XML and Office Services&lt;/a&gt; are really meant to work better together. In this post, I am going to show you how to leverage Word Automation Services to update a table of contents after a document has been modified by the Open XML SDK. &lt;/p&gt;  &lt;p&gt;If you want to jump straight into the code, feel free to download the solutions &lt;a href="http://zeyadrajabi.members.winisp.net/sourcecode/OpenXmlDemo.zip"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;object width="425" height="344"&gt;             &lt;param name="movie" value="http://www.youtube.com/v/exj_q4Yoxeo&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;/param&gt;             &lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;             &lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;             &lt;embed src="http://www.youtube.com/v/exj_q4Yoxeo&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;  &lt;h2&gt;Scenario &lt;/h2&gt;  &lt;p&gt;Imagine a scenario where I am working with a group of people to create a book about the solar system. We've divided up the book into separate chapters where each chapter is assigned to a particular author. Once everyone is done authoring their assigned chapter we want to merge all the documents into one final document. In fact, this scenario is very similar to the scenario I talked about in a previous post titled &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/12/08/the-easy-way-to-assemble-multiple-word-documents.aspx"&gt;the easy way to assemble multiple Word documents&lt;/a&gt;. The big difference is that in this scenario I want to make sure all page references, including the table of contents, are properly set in the final document. &lt;/p&gt;  &lt;h2&gt;Solution &lt;/h2&gt;  &lt;p&gt;The scenario discussed above requires two actions: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Assemble multiple Word documents into one final document using the Open XML SDK &lt;/li&gt;    &lt;li&gt;Leverage Word Automation Services, which is part of SharePoint 2010, to updates any fields, like the table of contents, within the document &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;As is the case with many of my &lt;a href="http://blogs.msdn.com/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/default.aspx"&gt;previous posts&lt;/a&gt; setting up the right template is the most important step in starting Office document solutions. Once we have the template setup, our next task is to come up with an easy way for users to run the document assembly solution. Since this solution will run on SharePoint, we will create a custom action, which users will be able to access right from a drop down menu off of the template document. This custom action will run the code necessary to assemble the document as well as call into Word Automation Services to update fields. &lt;/p&gt;  &lt;p&gt;In summary, we will need to take the following actions: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create the right template &lt;/li&gt;    &lt;li&gt;Create SharePoint libraries that will store the template as well as chapter documents &lt;/li&gt;    &lt;li&gt;Create a custom action that can be invoked from the SharePoint document drop down menu. This custom action will allow users to assemble all the documents together &lt;/li&gt;    &lt;li&gt;Using the Open XML SDK, open the template document and look for all content controls &lt;/li&gt;    &lt;li&gt;For every content control found, find the corresponding document in the library and merge that content into the final document &lt;/li&gt;    &lt;li&gt;Once the document assembly is complete, invoke Word Automation Services to update the fields in the final document &lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Step 1 – Creating the Right Template &lt;/h2&gt;  &lt;p&gt;The template will represent the final look of the document we want to create. In this template we will merge a specific chapter in a specific location within the template. We will leverage &lt;a href="http://blogs.msdn.com/microsoft_office_word/archive/2006/11/17/meet-the-controls.aspx"&gt;content controls&lt;/a&gt; as an easy mechanism for specifying semantic regions within a document. In other words, content controls allow us to uniquely identify a specific region within a document. Here is a screenshot of the template we will use: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_thumb.png" width="655" height="851" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;In the example above, we will use the content control named &amp;quot;SolarOverview&amp;quot; to represent the location where the solar system overview document will be merged. The content of the content control, in this case, &amp;quot;Planets/SolareOverview.docx&amp;quot;, represents the SharePoint library location of the document to be merged. &lt;/p&gt;  &lt;h2&gt;Step 2 – Leveraging SharePoint Libraries &lt;/h2&gt;  &lt;p&gt;The template document will exist in its own SharePoint library, while the chapters of the solar system book will be stored in the Planets SharePoint library: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_thumb_3.png" width="899" height="450" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;em&gt;Note: There is no technical reason to separate the location of the template document from the chapter documents. &lt;/em&gt;&lt;/p&gt;  &lt;h2&gt;Step 3 – Create a Custom Action within SharePoint &lt;/h2&gt;  &lt;p&gt;There are several ways to provide UI to users to allow them to invoke our document assembly solution. For the sake of this blog post, we are going to create a custom action that can invoke the document assembly solution straight off of the drop down menu for our template document. Here is a screenshot of the custom action we will create: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_thumb_4.png" width="704" height="571" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Notice that this custom action menu has two Assemble Open XML Document commands. The difference between these two commands is that one of the commands will also invoke Word Automation Services to update fields within the document. In order to create a custom action within SharePoint we will need to create our own custom feature. Here is the xml necessary to create such a feature: &lt;/p&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;Feature&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;Id&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2119559A-5740-42fa-83E5-C02FB46FC701&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;Title&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Open XML Demo&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;Description&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Open XML Demo&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;Version&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1.0.0.0&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;Scope&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Web&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;Hidden&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;FALSE&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;ImageUrl&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;menuprofile.gif&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;xmlns&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color: #a31515"&gt;ElementManifests&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;span style="color: #a31515"&gt;ElementManifest&lt;span style="color: blue"&gt; &lt;span style="color: red"&gt;Location&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;elements.xml&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;span style="color: #a31515"&gt;ElementManifests&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;/&lt;span style="color: #a31515"&gt;Feature&lt;span style="color: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;p&gt;Our next task is to define what this feature looks like via the elements.xml file: &lt;/p&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;Elements&lt;span style="color: blue"&gt; &lt;span style="color: red"&gt;xmlns&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;http://schemas.microsoft.com/sharepoint/&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;!--&lt;span style="color: green"&gt; Per Item Dropdown (ECB) Link &lt;span style="color: blue"&gt;--&amp;gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;CustomAction&lt;span style="color: blue"&gt; &lt;span style="color: red"&gt;Id&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Assemble Document&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;RegistrationType&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;List&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;RegistrationId&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;101&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;ImageUrl&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/_layouts/images/GORTL.GIF&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;Location&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;EditControlBlock&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;Sequence&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;101&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;Title&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Assemble Open XML Document&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;UrlAction&lt;span style="color: blue"&gt; &lt;span style="color: red"&gt;Url&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;~site/_layouts/CustomApplicationPages/AssembleDocument.aspx?ItemId={ItemId}&lt;span style="color: red"&gt;&amp;amp;amp;&lt;span style="color: blue"&gt;ListId={ListId}&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;/&lt;span style="color: #a31515"&gt;CustomAction&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;CustomAction&lt;span style="color: blue"&gt; &lt;span style="color: red"&gt;Id&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Assemble Document (New)&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;RegistrationType&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;List&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;RegistrationId&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;101&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;ImageUrl&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/_layouts/images/GORTL.GIF&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;Location&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;EditControlBlock&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;Sequence&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;101&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&lt;span style="color: red"&gt;Title&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Assemble Open XML Document (New)&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;&lt;span style="color: #a31515"&gt;UrlAction&lt;span style="color: blue"&gt; &lt;span style="color: red"&gt;Url&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;~site/_layouts/CustomApplicationPages/AssembleDocumentNew.aspx?ItemId={ItemId}&lt;span style="color: red"&gt;&amp;amp;amp;&lt;span style="color: blue"&gt;ListId={ListId}&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;/&lt;span style="color: #a31515"&gt;CustomAction&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: consolas; color: blue; font-size: 10pt"&gt;&amp;lt;/&lt;span style="color: #a31515"&gt;Elements&lt;span style="color: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;p&gt;The above xml defines two custom actions, called &amp;quot;Assemble Open XML Document&amp;quot; and &amp;quot;Assemble Open XML Document (New)&amp;quot;. These commands will direct users to two different ASP.NET urls, which will allow users to specify the name of the merged document. Both urls will contain a text field as well as an Assemble Document button: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_5.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_thumb_5.png" width="680" height="424" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h2&gt;Step 4 – Merge Documents with the Open XML SDK &lt;/h2&gt;  &lt;p&gt;The document assembly solution will be invoked via the Assemble Document button command from the ASP.NET url mentioned above. This command will perform the following actions: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Retrieve the template document from SharePoint library &lt;/li&gt;    &lt;li&gt;Open the template document with the Open XML SDK &lt;/li&gt;    &lt;li&gt;Retrieve all content controls and their content from the template document &lt;/li&gt;    &lt;li&gt;Retrieve all referenced documents from the appropriate SharePoint library &lt;/li&gt;    &lt;li&gt;Replace the content control within the template with the merged content from the SharePoint library (using altChunks) &lt;/li&gt;    &lt;li&gt;Save the final document with the name/path specified by the text field from the ASP.NET url &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The following code snippet accomplishes these actions: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 709px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; AssembleDocumentBtn_Click(&lt;span style="color: #2b91af"&gt;Object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPSite&lt;/span&gt; siteCollection = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Site; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPWeb&lt;/span&gt; site = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Web; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;site.AllowUnsafeUpdates = &lt;span style="color: blue"&gt;true&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;lblTemplateDocument.Text = tbNewDocumentName.Text + &lt;span style="color: #a31515"&gt;&amp;quot;&amp;lt;=====&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; ListId = Request.QueryString[&lt;span style="color: #a31515"&gt;&amp;quot;ListId&amp;quot;&lt;/span&gt;]; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPList&lt;/span&gt; list = site.Lists[&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Guid&lt;/span&gt;(ListId)]; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; ItemId = Request.QueryString[&lt;span style="color: #a31515"&gt;&amp;quot;ItemId&amp;quot;&lt;/span&gt;]; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPListItem&lt;/span&gt; item = list.Items.GetItemById(&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToInt32(ItemId)); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (list &lt;span style="color: blue"&gt;is&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SPDocumentLibrary&lt;/span&gt;) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPDocumentLibrary&lt;/span&gt; documentLibrary = (&lt;span style="color: #2b91af"&gt;SPDocumentLibrary&lt;/span&gt;)list; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPFile&lt;/span&gt; file = site.GetFile(item.Url); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;byte&lt;/span&gt;[] byteArray = file.OpenBinary(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt; mem = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;mem.Write(byteArray, &lt;span style="color: brown"&gt;0&lt;/span&gt;, (&lt;span style="color: blue"&gt;int&lt;/span&gt;)byteArray.Length); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt; myDoc = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt;.Open(mem, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; contentControls = myDoc.MainDocumentPart &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Document &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Descendants&amp;lt;&lt;span style="color: #2b91af"&gt;SdtBlock&lt;/span&gt;&amp;gt;() &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Select(b =&amp;gt; GetTextFromContentControl(b)); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; insertList = contentControls &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Select(s =&amp;gt; s.Trim().Split(&lt;span style="color: #a31515"&gt;'/'&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Where(g =&amp;gt; g.Count() == &lt;span style="color: brown"&gt;2&lt;/span&gt;) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Select(g =&amp;gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;DocumentLibrary = g[&lt;span style="color: brown"&gt;0&lt;/span&gt;], &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;DocumentName = g[&lt;span style="color: brown"&gt;1&lt;/span&gt;] &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; libraryList = insertList.Select(c =&amp;gt; c.DocumentLibrary) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Distinct().ToList(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;InsertDocument&lt;/span&gt;&amp;gt; insertDocumentList = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;InsertDocument&lt;/span&gt;&amp;gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;var&lt;/span&gt; lib &lt;span style="color: blue"&gt;in&lt;/span&gt; libraryList) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPList&lt;/span&gt; clauseList = site.Lists[lib]; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPListItemCollection&lt;/span&gt; listItems = clauseList.Items; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;// get list of all insert documents from the document&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;// libraries&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;for&lt;/span&gt; (&lt;span style="color: blue"&gt;int&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt;; i &amp;lt; listItems.Count; ++i) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;insertDocumentList.Add( &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 252pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;InsertDocument&lt;/span&gt;() &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 252pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 288pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;DocumentLibraryName = lib, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 288pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;DocumentName = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 324pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;listItems[i][&lt;span style="color: #a31515"&gt;&amp;quot;LinkFilename&amp;quot;&lt;/span&gt;] &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 324pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.ToString(), &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 324pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;ListItems = listItems &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 252pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 216pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;ReplaceContentControls(myDoc, insertDocumentList); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;// write it back to the document library&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPFolder&lt;/span&gt; fldr = site.GetFolder(list.RootFolder.Url); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPFileCollection&lt;/span&gt; files = fldr.Files; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;files.Add(tbNewDocumentName.Text, mem, &lt;span style="color: blue"&gt;true&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; libraryRelativePath = documentLibrary.RootFolder &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.ServerRelativeUrl; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; libraryPath = siteCollection.MakeFullUrl(libraryRelativePath); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Response.Redirect(libraryPath); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; ReplaceContentControls(&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt; myDoc, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;InsertDocument&lt;/span&gt;&amp;gt; insertDocumentList) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;MainDocumentPart&lt;/span&gt; mainPart = myDoc.MainDocumentPart; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;SdtBlock&lt;/span&gt;&amp;gt; sdtList = mainPart.Document.Descendants&amp;lt;&lt;span style="color: #2b91af"&gt;SdtBlock&lt;/span&gt;&amp;gt;() &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.ToList(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;var&lt;/span&gt; sdt &lt;span style="color: blue"&gt;in&lt;/span&gt; sdtList) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt;[] text = sdt.InnerText.Trim().Split(&lt;span style="color: #a31515"&gt;'/'&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;InsertDocument&lt;/span&gt; insertDocument = GetInsertDocument(insertDocumentList, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;text[&lt;span style="color: brown"&gt;0&lt;/span&gt;], text[&lt;span style="color: brown"&gt;1&lt;/span&gt;]); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (insertDocument != &lt;span style="color: blue"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;// create unique AltChunkId&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; altChunkId = &lt;span style="color: #a31515"&gt;&amp;quot;AltChunkId&amp;quot;&lt;/span&gt; + (insertDocument.Idx).ToString(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;// grab the file from SharePoint&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SPFile&lt;/span&gt; insertFile = insertDocument &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.ListItems[insertDocument.Idx].File; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;byte&lt;/span&gt;[] insertDocByteArray = insertFile.OpenBinary(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;// create the new chunk part&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;AlternativeFormatImportPart&lt;/span&gt; chunk = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;mainPart.AddAlternativeFormatImportPart( &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;AlternativeFormatImportPartType&lt;/span&gt;.WordprocessingML, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;altChunkId); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;// create a memory stream from the byte array, and feed the&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;// memory stream into the newly created chunk&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt; insertMem = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;insertMem.Write(insertDocByteArray, &lt;span style="color: brown"&gt;0&lt;/span&gt;, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;(&lt;span style="color: blue"&gt;int&lt;/span&gt;)insertDocByteArray.Length); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;insertMem.Seek(&lt;span style="color: brown"&gt;0&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;SeekOrigin&lt;/span&gt;.Begin); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;chunk.FeedData(insertMem); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;AltChunk&lt;/span&gt; altChunk = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AltChunk&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;altChunk.Id = altChunkId; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: green"&gt;// add the chunk element and remove the content control&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;OpenXmlElement&lt;/span&gt; parent = sdt.Parent; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;parent.InsertAfter(altChunk, sdt); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;sdt.Remove(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;mainPart.Document.Save(); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; GetTextFromContentControl(&lt;span style="color: #2b91af"&gt;SdtBlock&lt;/span&gt; contentControlNode) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; contentControlNode.Descendants&amp;lt;&lt;span style="color: #2b91af"&gt;Paragraph&lt;/span&gt;&amp;gt;() &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Select &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;( &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;p =&amp;gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;var&lt;/span&gt; t = p.Elements() &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Where(z =&amp;gt; z &lt;span style="color: blue"&gt;is&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Run&lt;/span&gt; || z &lt;span style="color: blue"&gt;is&lt;/span&gt; &lt;span style="color: #2b91af"&gt;InsertedRun&lt;/span&gt;) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.SelectMany(r =&amp;gt; r.Elements&amp;lt;&lt;span style="color: #2b91af"&gt;Text&lt;/span&gt;&amp;gt;()); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; t.StringConcatenate(text =&amp;gt; text.Text) + &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.NewLine; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;).StringConcatenate(); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;InsertDocument&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; DocumentLibraryName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; } &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; DocumentName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; } &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SPListItemCollection&lt;/span&gt; ListItems { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; } &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;int&lt;/span&gt; Idx { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; } &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;InsertDocument&lt;/span&gt; GetInsertDocument(&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;InsertDocument&lt;/span&gt;&amp;gt; source, &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; library, &lt;span style="color: blue"&gt;string&lt;/span&gt; document) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; source.Select( &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;(s, i) =&amp;gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;InsertDocument&lt;/span&gt;() &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;DocumentLibraryName = s.DocumentLibraryName, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;DocumentName = s.DocumentName, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;ListItems = s.ListItems, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Idx = i &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.Where(s =&amp;gt; s.DocumentLibraryName == library &amp;amp;&amp;amp; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;s.DocumentName == document) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.FirstOrDefault(); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;The above code snippet will merge the Open XML documents together and will ensure that all formatting and content are preserved. Here is a screenshot of how the merged document looks like: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_thumb_6.png" width="837" height="662" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;That being said, the code snippet will not update your table of contents, as shown below: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_7.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_thumb_7.png" width="648" height="675" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h2&gt;Step 5 – Updating Fields with Word Automation Services &lt;/h2&gt;  &lt;p&gt;Instead of requiring users to manually update their table of contents, we can perform this action automatically with Word Automation Services. That's where our second custom action command will come into play. The second custom action command is exactly the same as our first command except that it will also invoke Word Automation Services. Here is the code snippet for the second custom action command: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 598px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; AssembleDocumentNewBtn_Click(&lt;span style="color: #2b91af"&gt;Object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (list &lt;span style="color: blue"&gt;is&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SPDocumentLibrary&lt;/span&gt;) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; outputFileUrl = site.Url + &lt;span style="color: #a31515"&gt;&amp;quot;/&amp;quot;&lt;/span&gt; + tbNewDocumentName.Text; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;ConversionJob&lt;/span&gt; convJob = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ConversionJob&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Word Automation Services&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;convJob.Name = &lt;span style="color: #a31515"&gt;&amp;quot;Document Assembly&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;convJob.UserToken = site.CurrentUser.UserToken; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;convJob.Settings.UpdateFields = &lt;span style="color: blue"&gt;true&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;convJob.AddFile(outputFileUrl, outputFileUrl); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;convJob.Start(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; libraryRelativePath = documentLibrary.RootFolder &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;.ServerRelativeUrl; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; libraryPath = siteCollection.MakeFullUrl(libraryRelativePath); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Response.Redirect(libraryPath); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;As you can see, calling into Word Automation Services is pretty easy; it's only six lines of code! &lt;/p&gt;  &lt;h2&gt;End Result &lt;/h2&gt;  &lt;p&gt;Using the above code we should end up with a merged document that has an updated table of contents: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/LeveragingthePowerofWordAutomationServic_C747/image_thumb_8.png" width="654" height="743" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I am excited about this solution because it shows you the power of combining the Open XML SDK with Word Automation Services. &lt;/p&gt;  &lt;p&gt;Zeyad Rajabi&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9960801" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Word/">Word</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Open XML SDK Code behind the Custom XML Markup Detection Tool</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/01/27/open-xml-sdk-code-behind-the-custom-xml-markup-detection-tool.aspx</link><pubDate>Wed, 27 Jan 2010 17:12:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9954181</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9954181</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/01/27/open-xml-sdk-code-behind-the-custom-xml-markup-detection-tool.aspx#comments</comments><description>&lt;p&gt;Recently on Gray's blog he posted about a &lt;a href="http://blogs.technet.com/gray_knowlton/archive/2010/01/20/scanning-tool-to-detect-custom-xml-markup-in-docx-and-docm-files.aspx"&gt;scanning tool that can be used to detect custom XML markup in Word Open XML files&lt;/a&gt; (*.docx, *.docm, *.dotm, and *.dotx). The tool is built using the Open XML SDK and we wanted to take the opportunity to show you how the solution works in this blog. &lt;/p&gt;  &lt;h2&gt;Solution &lt;/h2&gt;  &lt;p&gt;The scenario we want to support is, given a directory, find all Word Open XML documents that contain custom XML markup (w:customXml elements). In order to accomplish this scenario we will need to take the following actions: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Given a directory, get all Word Open XML files &lt;/li&gt;    &lt;li&gt;For each file found, open the document with the Open XML SDK &lt;/li&gt;    &lt;li&gt;Get all xml parts contained with the document &lt;/li&gt;    &lt;li&gt;For each part, count the number of occurrences of custom XML markup. Count the total across all the parts contained within the document &lt;/li&gt;    &lt;li&gt;Show results of scan &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;If you want to jump straight into the code, feel free to download this solution &lt;a href="http://zeyadrajabi.members.winisp.net/sourcecode/DetectCustomXMLMarkup.zip"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;The solution uses the December 2009 CTP of the &lt;a href="http://go.microsoft.com/fwlink/?LinkId=127912"&gt;Open XML SDK 2.0 for Microsoft Office&lt;/a&gt;, which you can learn more about in this &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/10/06/open-xml-format-sdk-2-0.aspx"&gt;introduction to the Open XML SDK&lt;/a&gt;. You can certainly use &lt;a href="http://go.microsoft.com/fwlink/?LinkId=120908"&gt;version 1.0 of the Open XML SDK&lt;/a&gt;, but version 2.0 makes things a lot easier, especially with all the improvements added to the December 2009 CTP as described in the &lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/12/14/announcing-the-release-of-the-december-2009-ctp-for-the-open-xml-sdk.aspx"&gt;CTP announcement blog post&lt;/a&gt;. &lt;/p&gt;  &lt;h2&gt;Step 1 – Find all Word documents in a directory &lt;/h2&gt;  &lt;p&gt;For the sake of simplicity we are going to build a command line solution that expects one argument, which will represent the directory that will be scanned by the tool. Given this directory and all of its subdirectories, we are going to look for all Word Open XML documents, which have the following extensions: .docx, .docm, .dotx, and .dotm. Performing this task is pretty simple with the class &lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;DirectoryInfo&lt;/span&gt; and the method &lt;span style="font-family: courier new; font-size: 10pt"&gt;GetFiles&lt;/span&gt;. The only issue is that the &lt;span style="font-family: courier new; font-size: 10pt"&gt;GetFiles&lt;/span&gt; method only allows you to search for one extension at a time. Files or directories that cannot be scanned, for example due to file permissions, will be reported in a separate list. Here is a code snippet to solve this issue and look for all files given multiple extension types:&lt;span style="font-family: times new roman; font-size: 12pt"&gt; &lt;/span&gt;&lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 703px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; lookfor = &lt;span style="color: #a31515"&gt;&amp;quot;*.docx;*.docm;*.dotx;*.dotm&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt;[] extensions = lookfor.Split(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: blue"&gt;char&lt;/span&gt;[] { &lt;span style="color: #a31515"&gt;';'&lt;/span&gt; }); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;// Files with the above extensions will be added to this list &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; files = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;// Track files with errors (such as IRM-protected documents we cannot load) in a //separate list &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt; errors = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;int&lt;/span&gt; folderCount = 0; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; ShowHelp() &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;DetectCustomXMLMarkup.exe - Detect Custom XML Markup in &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #a31515"&gt;Documents Tool&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Usage:&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot; DetectCustomXMLMarkup.exe [Path To Folder]&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;@&amp;quot;Example: DetectCustomXMLMarkup.exe C:\temp&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;For more information about Custom XML Markup, please see &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #a31515"&gt;Microsoft Knowledge Base article 978951&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//Recursive method to get all files in a directory and all it's sub-directories &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; GetAllFiles(&lt;span style="color: blue"&gt;string&lt;/span&gt; parentFolder) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;folderCount++; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (folderCount % 10 == 0) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Write(&lt;span style="color: #a31515"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; color: blue; font-size: 10pt"&gt;try &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; ext &lt;span style="color: blue"&gt;in&lt;/span&gt; extensions) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;files.AddRange(&lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.GetFiles(parentFolder, ext, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SearchOption&lt;/span&gt;.TopDirectoryOnly)); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; subFolder &lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Directory&lt;/span&gt;.GetDirectories(parentFolder)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;GetAllFiles(subFolder); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//all files/directories that cannot be accessed will be reported as an error &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;catch&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;errors.Add(parentFolder, e.Message.Replace(&lt;span style="color: #a31515"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty).Replace(&lt;span style="color: #a31515"&gt;&amp;quot;\r&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty)); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (args.Length != 1) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;ShowHelp(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//args[0] represents the directory path to scan &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt; di = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DirectoryInfo&lt;/span&gt;(args[0]); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (di.Exists) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Write(&lt;span style="color: #a31515"&gt;&amp;quot;Scanning for Word Open XML files under {0}&amp;quot;&lt;/span&gt;, di.FullName); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;GetAllFiles(di.FullName); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Found {0} Word Open XML files...&amp;quot;&lt;/span&gt;, files.Count); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; color: blue; font-size: 10pt"&gt;else &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Path is incorrect or cannot be accessed. Try again or &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #a31515"&gt;specify another path.&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;ShowHelp(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Step 2 – Open Word documents with the Open XML SDK &lt;/h2&gt;  &lt;p&gt;Now that we have all the Word files to scan, our next step is to open each of these documents with the Open XML SDK. The Open XML SDK should be able to handle most Word Open XML files. However, there are occasions where the Word document may have issues that prevent it from being opened with the SDK. For example, IRM documents cannot be opened with the Open XML SDK. To ensure our solution continues to function despite these types of issues we can simply wrap the SDK &lt;span style="font-family: courier new; font-size: 10pt"&gt;Open&lt;/span&gt; method with a &lt;span style="font-family: courier new; color: blue; font-size: 10pt"&gt;try &lt;/span&gt;and &lt;span style="font-family: courier new; color: blue; font-size: 10pt"&gt;catch&lt;/span&gt;. Any errors detected will be reported in the errors list. Here is the code snippet to accomplish this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 703px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; fCount = 0; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;bool&lt;/span&gt; addFinalLine = &lt;span style="color: blue"&gt;false&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//Go through all files found &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; file &lt;span style="color: blue"&gt;in&lt;/span&gt; files) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (fCount++ % 100 == 0) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (addFinalLine) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Write(&lt;span style="color: #a31515"&gt;&amp;quot;Scanning files [{0}/{1}]&amp;quot;&lt;/span&gt;, fCount, files.Count); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;addFinalLine = &lt;span style="color: blue"&gt;true&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt; &lt;span style="color: blue"&gt;if&lt;/span&gt; (fCount % 5 == 0) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Write(&lt;span style="color: #a31515"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;addFinalLine = &lt;span style="color: blue"&gt;true&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; thisFile = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; color: blue; font-size: 10pt"&gt;try &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt; myDoc = &lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt;.Open(file, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;false&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//Get all parts within the package &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//Count occurrences of custom XML markup &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;catch&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt; e) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;errors.Add(file, e.Message.Replace(&lt;span style="color: #a31515"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty)); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;...&lt;span style="color: green"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h3&gt;Step 3 – Get all parts within a document &lt;/h3&gt;  &lt;p&gt;At this point we have the file opened with the Open XML SDK. The next step is to get all the parts within the package. For this task we are going to leverage some source code from Eric White's post on &lt;a href="http://blogs.msdn.com/ericwhite/archive/2008/09/18/how-to-create-a-list-of-all-parts-in-an-open-xml-document.aspx"&gt;how to create a list of all parts in an Open XML document&lt;/a&gt;. Essentially we are going to use two methods &lt;span style="font-family: courier new; font-size: 10pt"&gt;GetAllParts &lt;/span&gt;and &lt;span style="font-family: courier new; font-size: 10pt"&gt;AddPart &lt;/span&gt;to recursively find all XML based parts within a package. Here is the code snippet necessary to accomplish this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 703px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt; myDoc = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt;.Open(file.FullName, &lt;span style="color: blue"&gt;false&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//Get all parts within the package &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt;&amp;gt; parts = GetAllParts(myDoc); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//This method is used to recursively find all parts within a package &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; AddPart(&lt;span style="color: #2b91af"&gt;HashSet&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt;&amp;gt; partList, &lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt; part) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (partList.Contains(part)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//only add parts that are xml based &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (part.ContentType.EndsWith(&lt;span style="color: #a31515"&gt;&amp;quot;+xml&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;partList.Add(part); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;IdPartPair&lt;/span&gt; p &lt;span style="color: blue"&gt;in&lt;/span&gt; part.Parts) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;AddPart(partList, p.OpenXmlPart); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//This method is used to recursively find all parts within a package &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt;&amp;gt; GetAllParts(&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt; doc) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;HashSet&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt;&amp;gt; partList = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;HashSet&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt;&amp;gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;IdPartPair&lt;/span&gt; p &lt;span style="color: blue"&gt;in&lt;/span&gt; doc.Parts) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;AddPart(partList, p.OpenXmlPart); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; partList.ToList(); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;Step 4 – Count the occurrences of Custom XML markup &lt;/h2&gt;  &lt;p&gt;Now that we have all the XML related parts contained within our Word document, the next step is to scan each of those parts for Custom XML markup. This task should be pretty easy with the Open XML SDK. All files with detected custom XML markup will be reported in the results list. Here is the code snippet necessary to accomplish this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 703px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;// Files with detected custom XML markup will be added to this list &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt; results = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;();&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt; myDoc = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt;.Open(file.FullName, &lt;span style="color: blue"&gt;false&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; count = 0; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//Get all parts within the package &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt;&amp;gt; parts = GetAllParts(myDoc); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt; part &lt;span style="color: blue"&gt;in&lt;/span&gt; parts) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;count += NumberOccurrencesCustomXMLMarkup(part); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (count &amp;gt; 0) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;results.Add(file, count); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//Count all instances of custom XML markup within a given part &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;int&lt;/span&gt; NumberOccurrencesCustomXMLMarkup(&lt;span style="color: #2b91af"&gt;OpenXmlPart&lt;/span&gt; part) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; count = 0; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; ((part != &lt;span style="color: blue"&gt;null&lt;/span&gt;) &amp;amp;&amp;amp; (part.RootElement != &lt;span style="color: blue"&gt;null&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;count += part.RootElement.Descendants&amp;lt;&lt;span style="color: #2b91af"&gt;CustomXmlBlock&lt;/span&gt;&amp;gt;().Count(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;count += part.RootElement.Descendants&amp;lt;&lt;span style="color: #2b91af"&gt;CustomXmlCell&lt;/span&gt;&amp;gt;().Count(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;count += part.RootElement.Descendants&amp;lt;&lt;span style="color: #2b91af"&gt;CustomXmlRow&lt;/span&gt;&amp;gt;().Count(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;count += part.RootElement.Descendants&amp;lt;&lt;span style="color: #2b91af"&gt;CustomXmlRuby&lt;/span&gt;&amp;gt;().Count(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;count += part.RootElement.Descendants&amp;lt;&lt;span style="color: #2b91af"&gt;CustomXmlRun&lt;/span&gt;&amp;gt;().Count(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; count; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;The &lt;span style="font-family: courier new; font-size: 10pt"&gt;NumberOccurrencesCustomXMLMarkup&lt;/span&gt; method simply looks for the following Custom XML Markup related SDK objects: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;CustomXmlBlock&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;CustomXmlCell&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;CustomXmlRow&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;CustomXmlRuby&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span style="font-family: courier new; color: #2b91af; font-size: 10pt"&gt;CustomXmlRun&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Pretty easy stuff! &lt;/p&gt;  &lt;h2&gt;Step 5 – Reporting the results &lt;/h2&gt;  &lt;p&gt;The last step in the solution is to report the results as a text based log file. Here is the code snippet to accomplish this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 703px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; file &lt;span style="color: blue"&gt;in&lt;/span&gt; files) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (addFinalLine) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;File&lt;/span&gt;.Delete(&lt;span style="color: #a31515"&gt;&amp;quot;output.log&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Writing results file 'output.log'...&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; color: green; font-size: 10pt"&gt;//Output results to log file &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;StreamWriter&lt;/span&gt; sw = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;StreamWriter&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;output.log&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sw.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Scanned folder and sub-folders: {0}&amp;quot;&lt;/span&gt;, di.FullName); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sw.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sw.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Files with Custom XML Markup: [{0}/{1}]&amp;quot;&lt;/span&gt;, results.Count, files.Count); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (results.Count != 0) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sw.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;File Name\tCustom XML Markup References&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; filename &lt;span style="color: blue"&gt;in&lt;/span&gt; results.Keys) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sw.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;{0}\t{1}&amp;quot;&lt;/span&gt;, filename, results[filename]); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (errors.Count != 0) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sw.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sw.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Errors reported: [{0}]&amp;quot;&lt;/span&gt;, errors.Count); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sw.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;File Name\tError message&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue"&gt;string&lt;/span&gt; filename &lt;span style="color: blue"&gt;in&lt;/span&gt; errors.Keys) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;sw.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;{0}\t{1}&amp;quot;&lt;/span&gt;, filename, errors[filename]); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Scan completed.&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Files with Custom XML Markup: [{0}/{1}]&amp;quot;&lt;/span&gt;, results.Count, &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;files.Count); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Errors reported: [{0}]&amp;quot;&lt;/span&gt;, errors.Count); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;See 'output.log' for more details.&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Press any key to continue...&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ReadKey(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: courier new; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;End Result &lt;/h2&gt;  &lt;p&gt;Running this code on a directory we end up with a tab delimited log file that shows all the files that contain Custom XML markup. Here is a screenshot of how the log file looks like when opened in Microsoft Excel: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/OpenXMLSDKCodebehindtheCustomXMLMarkupDe_8561/image.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/OpenXMLSDKCodebehindtheCustomXMLMarkupDe_8561/image_thumb.png" width="653" height="402" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Hopefully this solution shows you how easy it is to interrogate an Open XML file with the Open XML SDK. &lt;/p&gt;  &lt;p&gt;Brian Jones + Zeyad Rajabi &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9954181" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category></item><item><title>Document Assembly: Merging Excel, PowerPoint, and Word Content Together</title><link>http://blogs.msdn.com/b/brian_jones/archive/2010/01/04/document-assembly-merging-excel-powerpoint-and-word-content-together.aspx</link><pubDate>Mon, 04 Jan 2010 16:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9943453</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9943453</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2010/01/04/document-assembly-merging-excel-powerpoint-and-word-content-together.aspx#comments</comments><description>&lt;P&gt;Document assembly seems to be a hot topic these days especially when combined with the power of SharePoint. Today, I want to show you a pretty rich document assembly solution that is able to take multiple Word, Excel and PowerPoint documents and merge them all together to form a final Word document. I showed this solution at both &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/11/23/open-xml-sdk-word-automation-services-presentation-at-pdc.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/11/23/open-xml-sdk-word-automation-services-presentation-at-pdc.aspx"&gt;PDC&lt;/A&gt; and &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/10/09/open-xml-sdk-sessions-at-the-sharepoint-conference-spc.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/10/09/open-xml-sdk-sessions-at-the-sharepoint-conference-spc.aspx"&gt;SPC&lt;/A&gt;, so I am going to take the opportunity in this blog to discuss some of the details around the solution. &lt;/P&gt;
&lt;P&gt;If you want to jump straight into the code, feel free to download the solution &lt;A href="http://zeyadrajabi.members.winisp.net/sourcecode/DocSetAssembly(SharePoint).zip" mce_href="http://zeyadrajabi.members.winisp.net/sourcecode/DocSetAssembly(SharePoint).zip"&gt;here&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;
&lt;OBJECT width=425 height=344&gt;&lt;PARAM NAME="movie" VALUE="http://www.youtube.com/v/abrjIFJHGhs&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;&lt;PARAM NAME="allowFullScreen" VALUE="true"&gt;&lt;PARAM NAME="allowscriptaccess" VALUE="always"&gt;
                                                                 &lt;embed src="http://www.youtube.com/v/abrjIFJHGhs&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" mce_src="http://www.youtube.com/v/abrjIFJHGhs&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/OBJECT&gt;&lt;/P&gt;
&lt;H2&gt;Scenario &lt;/H2&gt;
&lt;P&gt;Imagine a scenario where I work for a company that analyzes stocks and generates reports for every company/stock analyzed. These reports are typically quite rich and usually involve more than one person contributing to the content. Content is separated out into multiple Word, Excel, and PowerPoint documents where each document is assigned to an individual. Once all the content has been written, the content is all assembled into a final report as a Word document. My company has asked me to write a solution that will be able to merge all these documents programmatically. &lt;/P&gt;
&lt;H2&gt;Solution &lt;/H2&gt;
&lt;P&gt;Before I get into the details of my solution, I want to talk about a brand new feature of &lt;A href="http://blogs.msdn.com/sharepoint/archive/2009/10/19/sharepoint-2010.aspx" mce_href="http://blogs.msdn.com/sharepoint/archive/2009/10/19/sharepoint-2010.aspx"&gt;SharePoint 2010&lt;/A&gt;, called &lt;EM&gt;Document Sets&lt;/EM&gt;, which I will leverage to help solve this problem. Document Sets gives users a new way to manage a collection of documents as a single object. Think of this feature as allowing for a binder of related content. &lt;/P&gt;
&lt;P&gt;In the case of this solution, I have defined a custom Document Set as having a set of files (six in my case) that correspond to the various components of the final analysis report. Here is a screenshot of a Document Set for a company called Contoso: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image.png" mce_href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb.png" width=523 height=262 mce_src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using Document Sets and given the scenario I talked about above we will need to take the following actions: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a set of documents that represent the Document Set for my solution. One of the documents will be a Word template that represents the look and feel of the final report &lt;/LI&gt;
&lt;LI&gt;Create and add a custom Document Set to a SharePoint library &lt;/LI&gt;
&lt;LI&gt;Create a web part for the SharePoint library that has a button labeled "Assemble Documents", which will be used to merge all the content together into a final document. This web part will be added to the Document Set library &lt;/LI&gt;
&lt;LI&gt;Using the Open XML SDK, open the template document from the Document Set and look for all content controls &lt;/LI&gt;
&lt;LI&gt;For every content control found, find the corresponding document content in the library and merge that content into the final document &lt;/LI&gt;
&lt;LI&gt;Once the document assembly is complete, offer the user the ability to open or save the report &lt;/LI&gt;&lt;/OL&gt;
&lt;H2&gt;Step 1 – Creating the Right Template &lt;/H2&gt;
&lt;P&gt;Setting up the right template makes all the difference when creating Office document solutions. In the case of my solution I have a Document Set with six files, where one of the files is my template file. All these documents are empty except for the template document. As in many of my previous posts, the template document represents the final look of the final report. I will leverage &lt;A href="http://blogs.msdn.com/microsoft_office_word/archive/2006/11/17/meet-the-controls.aspx" mce_href="http://blogs.msdn.com/microsoft_office_word/archive/2006/11/17/meet-the-controls.aspx"&gt;content controls&lt;/A&gt; within my template to specify semantic regions within my document to be used to merge content together. The title of my content controls will represent the type of content to be merged. For example, a Word document, a chart from a spreadsheet, a table from a spreadsheet, or a SmartArt graphic from a presentation. The content of my content control will represent the name of the file that contains the content to be merged. For example, here is a screenshot of my template document highlighting one of my content controls labeled "Word:Document" with content set to "Introduction": &lt;/P&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_3.png" mce_href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_3.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_3.png" width=557 height=428 mce_src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This content control will represent the region where I will merge the Introduction Word document into my template file. For sake of completeness the other content controls are labeled "Spreadsheet:Chart", "Spreadsheet:Table", and "Presentation:SmartArt". &lt;/P&gt;
&lt;P&gt;You can find the files that represent my Document Set &lt;A href="http://zeyadrajabi.members.winisp.net/sourcecode/DocSetTemplates.zip" mce_href="http://zeyadrajabi.members.winisp.net/sourcecode/DocSetTemplates.zip"&gt;here&lt;/A&gt;. &lt;/P&gt;
&lt;H2&gt;Step 2 – Setting Up Document Sets in SharePoint 2010 &lt;/H2&gt;
&lt;P&gt;Perform the following steps to enable Document Sets on your SharePoint 2010 site: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Site Actions | Site Settings (top level site settings) &lt;/LI&gt;
&lt;LI&gt;Site Collections Administration | Site collection features &lt;/LI&gt;
&lt;LI&gt;Activate Document Sets feature, if not already activated &lt;/LI&gt;
&lt;LI&gt;Go to the Document Library where you want to add the Document Sets feature &lt;/LI&gt;
&lt;LI&gt;Site Actions | Site Settings &lt;/LI&gt;
&lt;LI&gt;Galleries | Site content types &lt;/LI&gt;
&lt;LI&gt;Create &lt;/LI&gt;
&lt;LI&gt;Set "Select parent content type from:" to "Document Set Content Types" &lt;/LI&gt;
&lt;LI&gt;Specify a name and click OK &lt;/LI&gt;
&lt;LI&gt;In the Site Content Types list click on the link to the created Document Set &lt;/LI&gt;
&lt;LI&gt;Document Set settings &lt;/LI&gt;
&lt;LI&gt;Specify the default content (in my case I added six documents to the set) and click OK &lt;/LI&gt;
&lt;LI&gt;Go to the Document Library where you want to add the Document Sets feature &lt;/LI&gt;
&lt;LI&gt;Library Tools | Library | Library Settings &lt;/LI&gt;
&lt;LI&gt;Advanced Settings &lt;/LI&gt;
&lt;LI&gt;Choose "Yes" for "Allow management of content types?" and click OK &lt;/LI&gt;
&lt;LI&gt;Content Types | Add from existing site content types &lt;/LI&gt;
&lt;LI&gt;Add your custom content type for the Document Set &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;At this point you should have a library set up with a Document Set content type. &lt;/P&gt;
&lt;H2&gt;Step 3 – Create a Web Part with an Assemble Documents Command &lt;/H2&gt;
&lt;P&gt;In order to make this solution usable, we need to add a command within our document library that allows users to merge documents together. The easiest way to accomplish this task is to create a Web Part within &lt;A href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx" mce_href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;Visual Studio 2010&lt;/A&gt;. Once you've created the Web Part modify the &lt;SPAN style="FONT-FAMILY: consolas"&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;CreateChildControls&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 15pt"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;method as follows: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 547px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; CreateChildControls() &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Control&lt;/SPAN&gt; control = &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.Page.LoadControl(_ascxPath); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Controls.Add(control); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.CreateChildControls(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Button&lt;/SPAN&gt; btnSubmit = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Button&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;btnSubmit.Text = &lt;SPAN style="COLOR: #a31515"&gt;"Assemble Documents"&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;btnSubmit.Click += &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;EventHandler&lt;/SPAN&gt;(btnSubmit_Click); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Controls.Add(btnSubmit); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;This method will add a new button control where we can add our logic to merge the documents contained within a given Document Set (the merge code will be called from&lt;SPAN style="FONT-FAMILY: consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="FONT-SIZE: 15pt"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;void&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt; btnSubmit_Click(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e)&lt;/SPAN&gt;&lt;/SPAN&gt;. &lt;/P&gt;
&lt;P&gt;Once we've created this web part, the next step is to add the button to our Document Set. The easiest way to accomplish this task is to use SharePoint Designer 2010. Perform the following steps to add your custom web part to the Document Set library: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Open your SharePoint site within SharePoint Designer 2010 &lt;/LI&gt;
&lt;LI&gt;Navigate to your document library that contains the Document Set &lt;/LI&gt;
&lt;LI&gt;All Files | Custom document library name | Forms | Document Set name | XXXXhomepage.aspx &lt;/LI&gt;
&lt;LI&gt;Click on the bottom of WebPartZone_CenterMain &lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;Insert | Web Part | select your custom web part created from Visual Studio &lt;/DIV&gt;
&lt;DIV&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_4.png" mce_href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_4.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_4.png" width=673 height=493 mce_src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_4.png"&gt;&lt;/A&gt; &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;Save and Close &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;At this point you should see an "Assemble Documents" command show up for any created Document Set: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_5.png" mce_href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_5.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_5.png" width=317 height=397 mce_src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_5.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Step 4 – Finding the Content Controls &lt;/H2&gt;
&lt;P&gt;Finding content controls within a document involves the following steps: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Open template document from the SharePoint site &lt;/LI&gt;
&lt;LI&gt;Load document into memory &lt;/LI&gt;
&lt;LI&gt;Open document (from memory) with the Open XML SDK &lt;/LI&gt;
&lt;LI&gt;Loop through all content controls within the document &lt;/LI&gt;
&lt;LI&gt;For every content control figure out the title &lt;/LI&gt;
&lt;LI&gt;Based on the title perform a particular action &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The following code accomplishes the steps outlined above: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 685px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; btnSubmit_Click(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;SPFolder&lt;/SPAN&gt; folder = &lt;SPAN style="COLOR: #2b91af"&gt;SPContext&lt;/SPAN&gt;.Current.ListItem.Folder; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt;[] splitter = { &lt;SPAN style="COLOR: #a31515"&gt;'/'&lt;/SPAN&gt; }; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[] folderName = folder.Name.Split(splitter); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; filePrefix = &lt;SPAN style="COLOR: #a31515"&gt;@"Stock Analysis Demo/"&lt;/SPAN&gt; + folderName[&lt;SPAN style="COLOR: brown"&gt;0&lt;/SPAN&gt;] + &lt;SPAN style="COLOR: #a31515"&gt;"/"&lt;/SPAN&gt; + folderName[&lt;SPAN style="COLOR: brown"&gt;0&lt;/SPAN&gt;]; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;SPFile&lt;/SPAN&gt; template = folder.Files[filePrefix + &lt;SPAN style="COLOR: #a31515"&gt;" - Template.docx"&lt;/SPAN&gt;]; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;SPFile&lt;/SPAN&gt; file; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;byte&lt;/SPAN&gt;[] byteArray = template.OpenBinary(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt; mem = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt;()) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mem.Write(byteArray, &lt;SPAN style="COLOR: brown"&gt;0&lt;/SPAN&gt;, (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)byteArray.Length); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; myDoc = &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt;.Open(mem, &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;)) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;MainDocumentPart&lt;/SPAN&gt; mainPart = myDoc.MainDocumentPart; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (Word.&lt;SPAN style="COLOR: #2b91af"&gt;SdtElement&lt;/SPAN&gt; sdt &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; mainPart.Document &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;.Descendants&amp;lt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;SdtElement&lt;/SPAN&gt;&amp;gt;().ToList()) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Alias&lt;/SPAN&gt; alias = sdt.Descendants&amp;lt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Alias&lt;/SPAN&gt;&amp;gt;() &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;.FirstOrDefault(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (alias != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; sdtTitle = alias.Val.Value; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (sdtTitle == &lt;SPAN style="COLOR: #a31515"&gt;"Spreadsheet:Table"&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;file = folder.Files[filePrefix + &lt;SPAN style="COLOR: #a31515"&gt;" - "&lt;/SPAN&gt; + &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;sdt.InnerText + &lt;SPAN style="COLOR: #a31515"&gt;".xlsx"&lt;/SPAN&gt;]; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;ImportTableFromSpreadsheet(mainPart, sdt, file); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;else&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (sdtTitle == &lt;SPAN style="COLOR: #a31515"&gt;"Spreadsheet:Chart"&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;file = folder.Files[filePrefix + &lt;SPAN style="COLOR: #a31515"&gt;" - "&lt;/SPAN&gt; + &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;sdt.InnerText + &lt;SPAN style="COLOR: #a31515"&gt;".xlsx"&lt;/SPAN&gt;]; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;ImportChartFromSpreadsheet(mainPart, sdt, file); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;else&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (sdtTitle == &lt;SPAN style="COLOR: #a31515"&gt;"Presentation:SmartArt"&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;file = folder.Files[filePrefix + &lt;SPAN style="COLOR: #a31515"&gt;" - "&lt;/SPAN&gt; + &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;sdt.InnerText + &lt;SPAN style="COLOR: #a31515"&gt;".pptx"&lt;/SPAN&gt;]; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;ImportSmartArtFromPowerPoint(mainPart, sdt, file); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;else&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (sdtTitle == &lt;SPAN style="COLOR: #a31515"&gt;"Word:Document"&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;file = folder.Files[filePrefix + &lt;SPAN style="COLOR: #a31515"&gt;" - "&lt;/SPAN&gt; + &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;sdt.InnerText + &lt;SPAN style="COLOR: #a31515"&gt;".docx"&lt;/SPAN&gt;]; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;AddAltChunk(mainPart, sdt, file); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;... &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;H2&gt;Step 5 – Merging Content Together &lt;/H2&gt;
&lt;P&gt;In this solution, there are four types of content to be merged: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Word documents &lt;/LI&gt;
&lt;LI&gt;SmartArt graphics from presentations &lt;/LI&gt;
&lt;LI&gt;Charts from spreadsheets &lt;/LI&gt;
&lt;LI&gt;Tables of data from spreadsheets &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Let's talk about each of these content types. &lt;/P&gt;
&lt;H3&gt;Step 5a – Merging Word Documents Together &lt;/H3&gt;
&lt;P&gt;By far the &lt;A href="http://blogs.msdn.com/brian_jones/archive/2008/12/08/the-easy-way-to-assemble-multiple-word-documents.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2008/12/08/the-easy-way-to-assemble-multiple-word-documents.aspx"&gt;easiest way to assemble Word documents together is to take advantage of altChunks&lt;/A&gt;, which I have already blogged about in the past. In any case, here is the code necessary to merge documents together on SharePoint: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 685px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; id = &lt;SPAN style="COLOR: brown"&gt;1&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; AddAltChunk(&lt;SPAN style="COLOR: #2b91af"&gt;MainDocumentPart&lt;/SPAN&gt; mainPart, Word.&lt;SPAN style="COLOR: #2b91af"&gt;SdtElement&lt;/SPAN&gt; sdt, &lt;SPAN style="COLOR: #2b91af"&gt;SPFile&lt;/SPAN&gt; filename) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; altChunkId = &lt;SPAN style="COLOR: #a31515"&gt;"AltChunkId"&lt;/SPAN&gt; + id; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;id++; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;byte&lt;/SPAN&gt;[] byteArray = filename.OpenBinary(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;AlternativeFormatImportPart&lt;/SPAN&gt; chunk = mainPart.AddAlternativeFormatImportPart( &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;AlternativeFormatImportPartType&lt;/SPAN&gt;.WordprocessingML, altChunkId); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt; mem = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt;()) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mem.Write(byteArray, &lt;SPAN style="COLOR: brown"&gt;0&lt;/SPAN&gt;, (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)byteArray.Length); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mem.Seek(&lt;SPAN style="COLOR: brown"&gt;0&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;SeekOrigin&lt;/SPAN&gt;.Begin); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;chunk.FeedData(mem); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;AltChunk&lt;/SPAN&gt; altChunk = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;AltChunk&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;altChunk.Id = altChunkId; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Replace content control with altChunk information &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;OpenXmlElement&lt;/SPAN&gt; parent = sdt.Parent; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;parent.InsertAfter(altChunk, sdt); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;sdt.Remove(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;Pretty easy stuff! &lt;/P&gt;
&lt;H3&gt;Step 5b – Import SmartArt Graphics from PowerPoint to Word &lt;/H3&gt;
&lt;P&gt;Again, I've already blogged about &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/06/04/importing-smartart-from-powerpoint-to-word.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/06/04/importing-smartart-from-powerpoint-to-word.aspx"&gt;importing SmartArt from PowerPoint to Word&lt;/A&gt;. Here is the code necessary to accomplish this task: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 823px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ImportSmartArtFromPowerPoint(&lt;SPAN style="COLOR: #2b91af"&gt;MainDocumentPart&lt;/SPAN&gt; mainPart, Word.&lt;SPAN style="COLOR: #2b91af"&gt;SdtElement&lt;/SPAN&gt; sdt, &lt;SPAN style="COLOR: #2b91af"&gt;SPFile&lt;/SPAN&gt; filename) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; docLayoutPartId = &lt;SPAN style="COLOR: #a31515"&gt;""&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; docDataPartId = &lt;SPAN style="COLOR: #a31515"&gt;""&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; docColorsPartId = &lt;SPAN style="COLOR: #a31515"&gt;""&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; docStylePartId = &lt;SPAN style="COLOR: #a31515"&gt;""&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;byte&lt;/SPAN&gt;[] byteArray = filename.OpenBinary(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt; mem = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt;()) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mem.Write(byteArray, &lt;SPAN style="COLOR: brown"&gt;0&lt;/SPAN&gt;, (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)byteArray.Length); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;PresentationDocument&lt;/SPAN&gt; myPres = &lt;SPAN style="COLOR: #2b91af"&gt;PresentationDocument&lt;/SPAN&gt;.Open(mem, &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;)) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;PresentationPart&lt;/SPAN&gt; presPart = myPres.PresentationPart; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Get the slide that contains the SmartArt graphic&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;SlidePart&lt;/SPAN&gt; slide = (&lt;SPAN style="COLOR: #2b91af"&gt;SlidePart&lt;/SPAN&gt;)presPart.GetPartById(&lt;SPAN style="COLOR: #a31515"&gt;"rId3"&lt;/SPAN&gt;); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Get all the appropriate parts associated with the SmartArt&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramLayoutDefinitionPart&lt;/SPAN&gt; layoutPart = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;slide.DiagramLayoutDefinitionParts.First(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramDataPart&lt;/SPAN&gt; dataPart = slide.DiagramDataParts.First(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramColorsPart&lt;/SPAN&gt; colorsPart = slide.DiagramColorsParts.First(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramStylePart&lt;/SPAN&gt; stylePart = slide.DiagramStyleParts.First(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Get some of the appropriate properties off the SmartArt graphic&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;PPT.&lt;SPAN style="COLOR: #2b91af"&gt;GraphicFrame&lt;/SPAN&gt; graphicFrame = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;slide.Slide.Descendants&amp;lt;PPT.&lt;SPAN style="COLOR: #2b91af"&gt;GraphicFrame&lt;/SPAN&gt;&amp;gt;().First(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;PPT.&lt;SPAN style="COLOR: #2b91af"&gt;NonVisualDrawingProperties&lt;/SPAN&gt; drawingPr = graphicFrame &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;.Descendants&amp;lt;PPT.&lt;SPAN style="COLOR: #2b91af"&gt;NonVisualDrawingProperties&lt;/SPAN&gt;&amp;gt;().First(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Draw.&lt;SPAN style="COLOR: #2b91af"&gt;Extents&lt;/SPAN&gt; extents = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;graphicFrame.Descendants&amp;lt;Draw.&lt;SPAN style="COLOR: #2b91af"&gt;Extents&lt;/SPAN&gt;&amp;gt;().First(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Import SmartArt into Word document&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Add the SmartArt parts to the Word document&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramLayoutDefinitionPart&lt;/SPAN&gt; docLayoutPart = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mainPart.AddPart&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramLayoutDefinitionPart&lt;/SPAN&gt;&amp;gt;(layoutPart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramDataPart&lt;/SPAN&gt; docDataPart = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mainPart.AddPart&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramDataPart&lt;/SPAN&gt;&amp;gt;(dataPart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramColorsPart&lt;/SPAN&gt; docColorsPart = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mainPart.AddPart&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramColorsPart&lt;/SPAN&gt;&amp;gt;(colorsPart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramStylePart&lt;/SPAN&gt; docStylePart = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mainPart.AddPart&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;DiagramStylePart&lt;/SPAN&gt;&amp;gt;(stylePart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Get all the relationship ids of the added parts&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;docLayoutPartId = mainPart.GetIdOfPart(docLayoutPart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;docDataPartId = mainPart.GetIdOfPart(docDataPart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;docColorsPartId = mainPart.GetIdOfPart(docColorsPart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;docStylePartId = mainPart.GetIdOfPart(docStylePart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Use the document reflector to figure out how to add a SmartArt &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//graphic to Word&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Change attribute values based on specifics related to the SmartArt&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Paragraph&lt;/SPAN&gt; p = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Paragraph&lt;/SPAN&gt;( &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Run&lt;/SPAN&gt;( &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Drawing&lt;/SPAN&gt;( &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; WP.&lt;SPAN style="COLOR: #2b91af"&gt;Inline&lt;/SPAN&gt;( &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; WP.&lt;SPAN style="COLOR: #2b91af"&gt;Extent&lt;/SPAN&gt;() { Cx = extents.Cx, Cy = extents.Cy }, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; WP.&lt;SPAN style="COLOR: #2b91af"&gt;EffectExtent&lt;/SPAN&gt;() &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 288pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;LeftEdge = &lt;SPAN style="COLOR: brown"&gt;0L&lt;/SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 288pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;TopEdge = &lt;SPAN style="COLOR: brown"&gt;0L&lt;/SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 288pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;RightEdge = &lt;SPAN style="COLOR: brown"&gt;0L&lt;/SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 288pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;BottomEdge = &lt;SPAN style="COLOR: brown"&gt;0L&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;}, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; WP.&lt;SPAN style="COLOR: #2b91af"&gt;DocProperties&lt;/SPAN&gt;() &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 288pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Id = drawingPr.Id, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 288pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Name = drawingPr.Name &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;}, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; WP.&lt;SPAN style="COLOR: #2b91af"&gt;NonVisualGraphicFrameDrawingProperties&lt;/SPAN&gt;(), &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Draw.&lt;SPAN style="COLOR: #2b91af"&gt;Graphic&lt;/SPAN&gt;( &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 288pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Draw.&lt;SPAN style="COLOR: #2b91af"&gt;GraphicData&lt;/SPAN&gt;( &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 324pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Dgm.&lt;SPAN style="COLOR: #2b91af"&gt;RelationshipIds&lt;/SPAN&gt;() &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 324pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 360pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;DataPart = docDataPartId, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 360pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;LayoutPart = docLayoutPartId, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 360pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;StylePart = docStylePartId, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 360pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;ColorPart = docColorsPartId &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 324pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 288pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;) { Uri = &lt;SPAN style="COLOR: #a31515"&gt;"http://schemas.openxmlformats.org/drawingml/2006/diagram"&lt;/SPAN&gt; }) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;DistanceFromTop = (&lt;SPAN style="COLOR: #2b91af"&gt;UInt32Value&lt;/SPAN&gt;)&lt;SPAN style="COLOR: brown"&gt;0U&lt;/SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;DistanceFromBottom = (&lt;SPAN style="COLOR: #2b91af"&gt;UInt32Value&lt;/SPAN&gt;)&lt;SPAN style="COLOR: brown"&gt;0U&lt;/SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;DistanceFromLeft = (&lt;SPAN style="COLOR: #2b91af"&gt;UInt32Value&lt;/SPAN&gt;)&lt;SPAN style="COLOR: brown"&gt;0U&lt;/SPAN&gt;, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;DistanceFromRight = (&lt;SPAN style="COLOR: #2b91af"&gt;UInt32Value&lt;/SPAN&gt;)&lt;SPAN style="COLOR: brown"&gt;0U&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;}))); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Swap out the content control for the SmartArt&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;OpenXmlElement&lt;/SPAN&gt; parent = sdt.Parent; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;parent.InsertAfter(p, sdt); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;sdt.Remove(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;The only difference between the code above and the code I showed you in my previous post is that the code above works with files on SharePoint. &lt;/P&gt;
&lt;H3&gt;Step 5c – Import Charts from Excel to Word &lt;/H3&gt;
&lt;P&gt;Again, I am going to leverage the same code I showed you in a previous post called &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/03/13/importing-charts-from-spreadsheets-to-wordprocessing-documents.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/03/13/importing-charts-from-spreadsheets-to-wordprocessing-documents.aspx"&gt;importing charts from spreadsheets to Word documents&lt;/A&gt;. Here is the same code modified to work with files that exist within SharePoint: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 715px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ImportChartFromSpreadsheet(&lt;SPAN style="COLOR: #2b91af"&gt;MainDocumentPart&lt;/SPAN&gt; mainPart, Word.&lt;SPAN style="COLOR: #2b91af"&gt;SdtElement&lt;/SPAN&gt; sdt, &lt;SPAN style="COLOR: #2b91af"&gt;SPFile&lt;/SPAN&gt; spreadsheetFileName) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//create a new paragraph that has an inline drawing object&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Paragraph&lt;/SPAN&gt; p = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Paragraph&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Run&lt;/SPAN&gt; r = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Run&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;p.Append(r); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Drawing&lt;/SPAN&gt; drawing = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Drawing&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;r.Append(drawing); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//These dimensions work perfectly for my template document&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;WP.&lt;SPAN style="COLOR: #2b91af"&gt;Inline&lt;/SPAN&gt; inline = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; WP.&lt;SPAN style="COLOR: #2b91af"&gt;Inline&lt;/SPAN&gt;( &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; WP.&lt;SPAN style="COLOR: #2b91af"&gt;Extent&lt;/SPAN&gt;() { Cx = &lt;SPAN style="COLOR: brown"&gt;5486400&lt;/SPAN&gt;, Cy = &lt;SPAN style="COLOR: brown"&gt;3200400&lt;/SPAN&gt; }); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;byte&lt;/SPAN&gt;[] byteArray = spreadsheetFileName.OpenBinary(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt; mem = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt;()) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mem.Write(byteArray, &lt;SPAN style="COLOR: brown"&gt;0&lt;/SPAN&gt;, (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)byteArray.Length); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Open Excel spreadsheet&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocument&lt;/SPAN&gt; mySpreadsheet = &lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocument&lt;/SPAN&gt;.Open(mem, &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;)) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Get all the appropriate parts&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;WorkbookPart&lt;/SPAN&gt; workbookPart = mySpreadsheet.WorkbookPart; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;WorksheetPart&lt;/SPAN&gt; worksheetPart = XLGetWorksheetPartByName(mySpreadsheet, &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #a31515"&gt;"Sheet2"&lt;/SPAN&gt;); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;DrawingsPart&lt;/SPAN&gt; drawingPart = worksheetPart.DrawingsPart; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ChartPart&lt;/SPAN&gt; chartPart = (&lt;SPAN style="COLOR: #2b91af"&gt;ChartPart&lt;/SPAN&gt;)drawingPart.GetPartById(&lt;SPAN style="COLOR: #a31515"&gt;"rId1"&lt;/SPAN&gt;); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Clone the chart part and add it to my Word document&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ChartPart&lt;/SPAN&gt; importedChartPart = mainPart.AddPart&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;ChartPart&lt;/SPAN&gt;&amp;gt;(chartPart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; relId = mainPart.GetIdOfPart(importedChartPart); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//The frame element contains information for the chart&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;GraphicFrame&lt;/SPAN&gt; frame = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;drawingPart.WorksheetDrawing.Descendants&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;GraphicFrame&lt;/SPAN&gt;&amp;gt;().First(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; chartName = frame.NonVisualGraphicFrameProperties.NonVisualDrawingProperties.Name; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Clone this node so we can add it to my Word document&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Draw.&lt;SPAN style="COLOR: #2b91af"&gt;Graphic&lt;/SPAN&gt; clonedGraphic = (Draw.&lt;SPAN style="COLOR: #2b91af"&gt;Graphic&lt;/SPAN&gt;)frame.Graphic.CloneNode(&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ChartReference&lt;/SPAN&gt; c = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;clonedGraphic.GraphicData.GetFirstChild&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;ChartReference&lt;/SPAN&gt;&amp;gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;c.Id = relId; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Give the chart a unique id and name&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;WP.&lt;SPAN style="COLOR: #2b91af"&gt;DocProperties&lt;/SPAN&gt; docPr = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; WP.&lt;SPAN style="COLOR: #2b91af"&gt;DocProperties&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;docPr.Name = chartName; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;docPr.Id = GetMaxDocPrId(mainPart) + &lt;SPAN style="COLOR: brown"&gt;1&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//add the chart data to the inline drawing object&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;inline.Append(docPr, clonedGraphic); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;drawing.Append(inline); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;OpenXmlElement&lt;/SPAN&gt; parent = sdt.Parent; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;parent.InsertAfter(p, sdt); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;sdt.Remove(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;WorksheetPart&lt;/SPAN&gt; XLGetWorksheetPartByName(&lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocument&lt;/SPAN&gt; document, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; sheetName) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;WorkbookPart&lt;/SPAN&gt; wbPart = document.WorkbookPart; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// Find the sheet with the supplied name, and then use that Sheet object&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// to retrieve a reference to the appropriate worksheet.&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Excel.&lt;SPAN style="COLOR: #2b91af"&gt;Sheet&lt;/SPAN&gt; theSheet = wbPart.Workbook.Descendants&amp;lt;Excel.&lt;SPAN style="COLOR: #2b91af"&gt;Sheet&lt;/SPAN&gt;&amp;gt;() &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;.Where(s =&amp;gt; s.Name == sheetName).FirstOrDefault(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (theSheet == &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;throw&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArgumentException&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"sheetName"&lt;/SPAN&gt;); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;WorksheetPart&lt;/SPAN&gt;)(wbPart.GetPartById(theSheet.Id)); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;uint&lt;/SPAN&gt; GetMaxDocPrId(&lt;SPAN style="COLOR: #2b91af"&gt;MainDocumentPart&lt;/SPAN&gt; mainPart) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;uint&lt;/SPAN&gt; max = &lt;SPAN style="COLOR: brown"&gt;1&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Get max id value of docPr elements &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (WP.&lt;SPAN style="COLOR: #2b91af"&gt;DocProperties&lt;/SPAN&gt; docPr &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; mainPart.Document.Descendants&amp;lt;WP.&lt;SPAN style="COLOR: #2b91af"&gt;DocProperties&lt;/SPAN&gt;&amp;gt;()) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;uint&lt;/SPAN&gt; id = docPr.Id; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (id &amp;gt; max) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;max = id; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; max; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;H3&gt;Step 5d – Import Table of Data from Excel to Word &lt;/H3&gt;
&lt;P&gt;In a previous post I showed you how to &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/04/01/importing-a-table-from-wordprocessingml-to-spreadsheetml.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/04/01/importing-a-table-from-wordprocessingml-to-spreadsheetml.aspx"&gt;import a table from Word to Excel&lt;/A&gt;. Today, I will show you how to do the reverse. Here are the steps necessary to accomplish this task: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a Word table with the Open XML SDK that will hold the data from Excel &lt;/LI&gt;
&lt;LI&gt;Open the Excel file with the Open XML SDK &lt;/LI&gt;
&lt;LI&gt;Retrieve the specific sheet that contains the table of data &lt;/LI&gt;
&lt;LI&gt;In the found sheet, locate the SheetData object, which contains the table of data &lt;/LI&gt;
&lt;LI&gt;For every row in the SheetData object, retrieve all the cell data &lt;/LI&gt;
&lt;LI&gt;Once all data in the row is retrieved, create a Word row with the same data &lt;/LI&gt;
&lt;LI&gt;Append the created Word row to the Word table &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;To help with the tasks listed above I am going to take advantage of some of the &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/09/17/open-xml-sdk-code-snippets.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/09/17/open-xml-sdk-code-snippets.aspx"&gt;Open XML SDK code snippets&lt;/A&gt; that were published. Here is the code necessary to accomplish the tasks outlined above: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 753px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ImportTableFromSpreadsheet(&lt;SPAN style="COLOR: #2b91af"&gt;MainDocumentPart&lt;/SPAN&gt; mainPart, Word.&lt;SPAN style="COLOR: #2b91af"&gt;SdtElement&lt;/SPAN&gt; sdt, &lt;SPAN style="COLOR: #2b91af"&gt;SPFile&lt;/SPAN&gt; spreadsheetFileName) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ArrayList&lt;/SPAN&gt; cellText = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArrayList&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//create Word table&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Table&lt;/SPAN&gt; tbl = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Table&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableProperties&lt;/SPAN&gt; tblPr = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableProperties&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableStyle&lt;/SPAN&gt; tblStyle = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableStyle&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;tblStyle.Val = &lt;SPAN style="COLOR: #a31515"&gt;"LightShading-Accent1"&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;tblPr.AppendChild(tblStyle); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableWidth&lt;/SPAN&gt; tblW = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableWidth&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;tblW.Width = &lt;SPAN style="COLOR: brown"&gt;5000&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;tblW.Type = Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableWidthUnitValues&lt;/SPAN&gt;.Pct; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;tblPr.Append(tblW); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;tbl.AppendChild(tblPr); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;byte&lt;/SPAN&gt;[] byteArray = spreadsheetFileName.OpenBinary(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt; mem = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;MemoryStream&lt;/SPAN&gt;()) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;mem.Write(byteArray, &lt;SPAN style="COLOR: brown"&gt;0&lt;/SPAN&gt;, (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)byteArray.Length); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocument&lt;/SPAN&gt; mySpreadsheet = &lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocument&lt;/SPAN&gt;.Open(mem, &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;)) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;WorkbookPart&lt;/SPAN&gt; workbookPart = mySpreadsheet.WorkbookPart; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;WorksheetPart&lt;/SPAN&gt; worksheetPart = XLGetWorksheetPartByName(mySpreadsheet, &lt;SPAN style="COLOR: #a31515"&gt;"Sheet1"&lt;/SPAN&gt;); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Excel.&lt;SPAN style="COLOR: #2b91af"&gt;SheetData&lt;/SPAN&gt; sheetData = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;worksheetPart.Worksheet.GetFirstChild&amp;lt;Excel.&lt;SPAN style="COLOR: #2b91af"&gt;SheetData&lt;/SPAN&gt;&amp;gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (Excel.&lt;SPAN style="COLOR: #2b91af"&gt;Row&lt;/SPAN&gt; r &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; sheetData) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (Excel.&lt;SPAN style="COLOR: #2b91af"&gt;Cell&lt;/SPAN&gt; c &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; r) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;cellText.Add(XLGetCellValue(c, workbookPart)); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableRow&lt;/SPAN&gt; tr = CreateRow(cellText); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;tbl.Append(tr); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;cellText = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArrayList&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//Swap out the content control for the SmartArt&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;OpenXmlElement&lt;/SPAN&gt; parent = sdt.Parent; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;parent.InsertAfter(tbl, sdt); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;sdt.Remove(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableRow&lt;/SPAN&gt; CreateRow(&lt;SPAN style="COLOR: #2b91af"&gt;ArrayList&lt;/SPAN&gt; cellText) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableRow&lt;/SPAN&gt; tr = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableRow&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;//create cells with simple text &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; s &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; cellText) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableCell&lt;/SPAN&gt; tc = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;TableCell&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Paragraph&lt;/SPAN&gt; p = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Paragraph&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Run&lt;/SPAN&gt; r = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Run&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;Word.&lt;SPAN style="COLOR: #2b91af"&gt;Text&lt;/SPAN&gt; t = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Word.&lt;SPAN style="COLOR: #2b91af"&gt;Text&lt;/SPAN&gt;(s); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;r.AppendChild(t); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;p.AppendChild(r); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;tc.AppendChild(p); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;tr.AppendChild(tc); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; tr; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// Get the value of a cell, given a file name, sheet name, and address name.&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; XLGetCellValue(Excel.&lt;SPAN style="COLOR: #2b91af"&gt;Cell&lt;/SPAN&gt; c, &lt;SPAN style="COLOR: #2b91af"&gt;WorkbookPart&lt;/SPAN&gt; wbPart) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; value = &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// If the cell doesn't exist, return an empty string:&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (c != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;value = c.InnerText; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// If the cell represents an integer number, you're done. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// For dates, this code returns the serialized value that &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// represents the date. The code handles strings and booleans&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// individually. For shared strings, the code looks up the corresponding&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// value in the shared string table. For booleans, the code converts &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// the value into the words TRUE or FALSE.&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (c.DataType != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;switch&lt;/SPAN&gt; (c.DataType.Value) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;case&lt;/SPAN&gt; Excel.&lt;SPAN style="COLOR: #2b91af"&gt;CellValues&lt;/SPAN&gt;.SharedString: &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// For shared strings, look up the value in the shared strings table.&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;var&lt;/SPAN&gt; stringTable = wbPart.GetPartsOfType&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;SharedStringTablePart&lt;/SPAN&gt;&amp;gt;().FirstOrDefault(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// If the shared string table is missing, something's wrong.&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// Just return the index that you found in the cell.&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: green"&gt;// Otherwise, look up the correct text in the table.&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (stringTable != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;value = stringTable.SharedStringTable.ElementAt(&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;.Parse(value)).InnerText; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;break&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;case&lt;/SPAN&gt; Excel.&lt;SPAN style="COLOR: #2b91af"&gt;CellValues&lt;/SPAN&gt;.Boolean: &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;switch&lt;/SPAN&gt; (value) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;case&lt;/SPAN&gt; &lt;SPAN style="COLOR: #a31515"&gt;"0"&lt;/SPAN&gt;: &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;value = &lt;SPAN style="COLOR: #a31515"&gt;"FALSE"&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;break&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;default&lt;/SPAN&gt;: &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;value = &lt;SPAN style="COLOR: #a31515"&gt;"TRUE"&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;break&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;break&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; value; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;H2&gt;Step 6 – Offer Assembled Document to User &lt;/H2&gt;
&lt;P&gt;The last step is to offer the assembled document to the user with an Open/Save/Cancel dialog as follows: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_6.png" mce_href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_6.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_6.png" width=399 height=288 mce_src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_6.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code snippet to create this dialog based on a document that is in memory: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 685px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; btnSubmit_Click(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;... &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;HttpResponse&lt;/SPAN&gt; resp = &lt;SPAN style="COLOR: #2b91af"&gt;HttpContext&lt;/SPAN&gt;.Current.Response; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;resp.ClearContent(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;resp.ClearHeaders(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;resp.AddHeader(&lt;SPAN style="COLOR: #a31515"&gt;"Content-Disposition"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"attachment; filename=Assembled Document.docx"&lt;/SPAN&gt;); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;resp.ContentEncoding = System.Text.&lt;SPAN style="COLOR: #2b91af"&gt;Encoding&lt;/SPAN&gt;.UTF8; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;resp.OutputStream.Write(mem.ToArray(), &lt;SPAN style="COLOR: brown"&gt;0&lt;/SPAN&gt;, (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)mem.Length); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;resp.Flush(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;resp.Close(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;resp.End(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;H2&gt;End Result &lt;/H2&gt;
&lt;P&gt;Putting everything together and running the code we end up with a document that contains all the content contained within our library merged into a final report: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_7.png" mce_href="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_7.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_7.png" width=714 height=815 mce_src="http://zeyadrajabi.members.winisp.net/DocumentAssemblyMergingExcelPowerPointan_7EED/image_thumb_7.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pretty cool stuff! &lt;/P&gt;
&lt;P&gt;Zeyad Rajabi&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9943453" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category></item><item><title>Announcing the Release of the December 2009 CTP for the Open XML SDK</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/12/14/announcing-the-release-of-the-december-2009-ctp-for-the-open-xml-sdk.aspx</link><pubDate>Mon, 14 Dec 2009 23:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9936805</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9936805</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/12/14/announcing-the-release-of-the-december-2009-ctp-for-the-open-xml-sdk.aspx#comments</comments><description>&lt;P&gt;I'm really happy to announce the &lt;A href="http://go.microsoft.com/fwlink/?LinkId=127912" mce_href="http://go.microsoft.com/fwlink/?LinkId=127912"&gt;4&lt;SUP&gt;th&lt;/SUP&gt; CTP for the Open XML SDK 2.0 for Microsoft Office&lt;/A&gt;! There were four major improvements we made to the SDK: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Full support for the Office 2010 Open XML formats &lt;/LI&gt;
&lt;LI&gt;Office 2010 schema and semantic level validation &lt;/LI&gt;
&lt;LI&gt;General improvements based on a recent Open XML SDK usability study &lt;/LI&gt;
&lt;LI&gt;Open XML SDK tools improvement &lt;/LI&gt;&lt;/OL&gt;
&lt;H2&gt;Full Support for the Office 2010 Open XML Formats &lt;/H2&gt;
&lt;P&gt;With the latest CTP you are able to create, edit, and consume Office generated Open XML formats for either Office 2007 or Office 2010. Looking back at the original Open XML SDK architecture diagram I showed you when we first &lt;A href="http://blogs.msdn.com/brian_jones/archive/2008/10/06/open-xml-format-sdk-2-0.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2008/10/06/open-xml-format-sdk-2-0.aspx"&gt;announced the Open XML SDK&lt;/A&gt;, we have extended the base level layer to include Office 2010 support: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image.png" mce_href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_thumb.png" width=616 height=171 mce_src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;What does that mean? Well, let me show you some examples. &lt;/P&gt;
&lt;P&gt;The Open XML Packaging API component allows you to add/remove parts within an Open XML package. This component functions by providing you strongly typed classes for every part within a package. In Office 2010 we've added new parts to the package in order to support some of our new features. With this CTP you are able to deal with these new parts with classes. For example, Word 2010 added a new part called &lt;A href="http://msdn.microsoft.com/en-us/library/dd908153.aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd908153.aspx"&gt;stylesWithEffects&lt;/A&gt;. This part is used to help round trip styles that are based on &lt;A href="http://blogs.msdn.com/microsoft_office_word/archive/2009/07/14/introducing-word-2010.aspx" mce_href="http://blogs.msdn.com/microsoft_office_word/archive/2009/07/14/introducing-word-2010.aspx"&gt;Word's new text effects feature&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_3.png" mce_href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_3.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_thumb_3.png" width=478 height=282 mce_src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Open XML Low Level DOM component allows you to create, edit, or consume xml contained in parts contained within an Open XML package. Like the packaging API component, this component functions by providing you with strongly typed classes for every element supported within the xml. For example, imagine we have the following text in a Word document, which uses the new text effects feature glow: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_4.png" mce_href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_4.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_thumb_4.png" width=399 height=107 mce_src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_thumb_4.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This text is represented in xml and the Open XML SDK as the following: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse" border=0 width=882&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 310px"&gt;
&lt;COL style="WIDTH: 328px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR style="BACKGROUND: #4f81bd"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #4f81bd 1pt solid"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;XML&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #4f81bd 1pt solid; BORDER-RIGHT: #4f81bd 1pt solid" width=492&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;Open XML SDK Code&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP-STYLE: none"&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/clip_image001.png" mce_href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/clip_image001.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=clip_image001 border=0 alt=clip_image001 src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/clip_image001_thumb.png" width=361 height=361 mce_src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/clip_image001_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP-STYLE: none; BORDER-RIGHT: #4f81bd 1pt solid" width=492&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; W14 = DocumentFormat.OpenXml.Office2010.Word; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;... &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Run&lt;/SPAN&gt; run2 = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Run&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;RunProperties&lt;/SPAN&gt; runProperties1 = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RunProperties&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;W14.&lt;SPAN style="COLOR: #2b91af"&gt;Glow&lt;/SPAN&gt; glow1 = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; W14.&lt;SPAN style="COLOR: #2b91af"&gt;Glow&lt;/SPAN&gt;() { GlowRadius = 228600L }; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;W14.&lt;SPAN style="COLOR: #2b91af"&gt;SchemeColor&lt;/SPAN&gt; schemeColor1 = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; W14.&lt;SPAN style="COLOR: #2b91af"&gt;SchemeColor&lt;/SPAN&gt;() &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;{ Val = W14.&lt;SPAN style="COLOR: #2b91af"&gt;SchemeColorValues&lt;/SPAN&gt;.ExtraSchemeColor5 }; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;W14.&lt;SPAN style="COLOR: #2b91af"&gt;Alpha&lt;/SPAN&gt; alpha1 = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; W14.&lt;SPAN style="COLOR: #2b91af"&gt;Alpha&lt;/SPAN&gt;() { Val = 60000 }; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;W14.&lt;SPAN style="COLOR: #2b91af"&gt;SaturationModulation&lt;/SPAN&gt; saturationModulation1 = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; W14.&lt;SPAN style="COLOR: #2b91af"&gt;SaturationModulation&lt;/SPAN&gt;() { Val = 175000 }; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;schemeColor1.Append(alpha1); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;schemeColor1.Append(saturationModulation1); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;glow1.Append(schemeColor1); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;runProperties1.Append(glow1); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Text&lt;/SPAN&gt; text2 = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Text&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;text2.Text = &lt;SPAN style="COLOR: #a31515"&gt;"text effects"&lt;/SPAN&gt;; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;... &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;As you can see from the code snippet above, leveraging the Office 2010 Open XML functionality of the SDK is as simple as including the appropriate set of namespace references. &lt;/P&gt;
&lt;H2&gt;Office 2010 Schema and Semantic Level Validation &lt;/H2&gt;
&lt;P&gt;In a previous post I talked about &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/09/24/finding-open-xml-errors-with-open-xml-sdk-validation.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/09/24/finding-open-xml-errors-with-open-xml-sdk-validation.aspx"&gt;how to find Open XML errors with the Open XML SDK validation functionality&lt;/A&gt;. In that post, I talked about finding both schema and semantic (constraints defined in the prose of the documentation that are not represented in schema markup) validation errors. With the latest SDK CTP you are now able to differentiate between errors specific to Office 2007 or Office 2010. The code to validate a file is pretty much the same as the code I showed in the previous post mentioned. The major difference is that we moved the validation functionality to be under its own namespace reference: "&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; DocumentFormat.OpenXml.Validation&lt;/SPAN&gt;". We moved this functionality to its own namespace to improve discoverability of the feature. The &lt;SPAN style="FONT-FAMILY: courier new; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;OpenXmlValidator&lt;/SPAN&gt; class now takes in an enumeration called &lt;SPAN style="FONT-FAMILY: courier new; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;FileFormatVersions&lt;/SPAN&gt; that allows you to specify either Office 2007 or 2010: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_5.png" mce_href="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_5.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=image border=0 alt=image src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_thumb_5.png" width=566 height=110 mce_src="http://zeyadrajabi.members.winisp.net/AnnouncingtheReleaseoftheDecember2009CTP_D6BC/image_thumb_5.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The validation functionality also has the ability to automatically deal with extensibility markup, like alternate content blocks, as defined by the Open XML standard. &lt;/P&gt;
&lt;H2&gt;General Open XML SDK Improvements &lt;/H2&gt;
&lt;P&gt;We recently conducted a usability study for the Open XML SDK where we asked participants to complete a set of tasks. Based on the results of the study we found that users had issues around the complexity of the Open XML SDK Open methods. In the August 2009 CTP of the SDK, each of the classes &lt;SPAN style="FONT-FAMILY: courier new; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;WordprocessingDocument&lt;/SPAN&gt;, &lt;SPAN style="FONT-FAMILY: courier new; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;SpreadsheetDocument&lt;/SPAN&gt; and &lt;SPAN style="FONT-FAMILY: courier new; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;PresentationDocument&lt;/SPAN&gt; had nine overloaded Open methods. For example, let's look at the &lt;SPAN style="FONT-FAMILY: courier new; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;WordprocessingDocument&lt;/SPAN&gt; class as an example: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Package&lt;/SPAN&gt; package); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Package&lt;/SPAN&gt; package, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Stream&lt;/SPAN&gt; stream, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; path, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Package&lt;/SPAN&gt; package, &lt;SPAN style="COLOR: #2b91af"&gt;MCMode&lt;/SPAN&gt; mode, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; processMCInWholePackage); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Stream&lt;/SPAN&gt; stream, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; path, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; autoSave); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Stream&lt;/SPAN&gt; stream, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable, &lt;SPAN style="COLOR: #2b91af"&gt;MCMode&lt;/SPAN&gt; mode, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; processMCInWholePackage); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; path, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable, &lt;SPAN style="COLOR: #2b91af"&gt;MCMode&lt;/SPAN&gt; mode, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; processMCInWholePackage); &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Now with the latest CTP, the number of overloaded methods for Open has been reduced to six methods: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Package&lt;/SPAN&gt; package); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Package&lt;/SPAN&gt; package, &lt;SPAN style="COLOR: #2b91af"&gt;OpenSettings&lt;/SPAN&gt; openSettings); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Stream&lt;/SPAN&gt; stream, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; path, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: #2b91af"&gt;Stream&lt;/SPAN&gt; stream, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable, &lt;SPAN style="COLOR: #2b91af"&gt;OpenSettings&lt;/SPAN&gt; openSettings); &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-FAMILY: courier new; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt; Open(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; path, &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEditable, &lt;SPAN style="COLOR: #2b91af"&gt;OpenSettings&lt;/SPAN&gt; openSettings);&lt;/SPAN&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Advanced open settings are now part of a new class called &lt;SPAN style="FONT-FAMILY: courier new; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;OpenSettings&lt;/SPAN&gt;. This class allows you to pre-process documents according to markup compatibility, auto save files, or caps the open method to deal with a specific number of characters within a part. Hopefully this change will make it easier to deal with the Open method. &lt;/P&gt;
&lt;H2&gt;Open XML SDK Tool Improvements &lt;/H2&gt;
&lt;P&gt;The last major improvement I want to call out is around the free Open XML SDK tool that comes with the SDK. In the August 2009 CTP, the Open XML SDK shipped with three separate tools: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Document Reflector &lt;/LI&gt;
&lt;LI&gt;Open XML Class Explorer &lt;/LI&gt;
&lt;LI&gt;Open XML Diff &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Based on feedback we have separated the download of the tools from the SDK dll. In other words, the &lt;A href="http://go.microsoft.com/fwlink/?LinkId=127912" mce_href="http://go.microsoft.com/fwlink/?LinkId=127912"&gt;Open XML SDK download page&lt;/A&gt; now has two download links: one for the SDK dll and one for a new consolidated Open XML SDK tool. As of the December 2009 CTP, the Open XML SDK tools are consolidated into one tool. In addition we've added some new functionality to the SDK. Here is a video that shows you an overview of the new tool: &lt;/P&gt;
&lt;P&gt;
&lt;OBJECT width=425 height=344&gt;&lt;PARAM NAME="movie" VALUE="http://www.youtube.com/v/KSSMLR19JWA&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;PARAM NAME="allowFullScreen" VALUE="true"&gt;&lt;PARAM NAME="allowscriptaccess" VALUE="always"&gt;
&lt;embed src="http://www.youtube.com/v/KSSMLR19JWA&amp;amp;hl=en&amp;amp;fs=1" mce_src="http://www.youtube.com/v/KSSMLR19JWA&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/OBJECT&gt;&lt;/P&gt;
&lt;P&gt;The new tool adds the following functionality: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Documentation for Office 2010 Open XML formats &lt;/LI&gt;
&lt;LI&gt;Validation functionality. This feature allows you to validate Open XML files according to Office 2007 or Office 2010 &lt;/LI&gt;
&lt;LI&gt;New reflection feature that combines reflection with the Open XML Diff feature. This new feature allows you to automatically generate SDK code that transforms one document into another document &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Let us know what you think of the new tool. I think of the new tool as the Open XML version of Macro Recording. &lt;/P&gt;
&lt;H2&gt;More Feedback Always Welcome &lt;/H2&gt;
&lt;P&gt;Please continue to send us your feedback, either on this blog or at our &lt;A href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=589" mce_href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=589"&gt;Microsoft Connect site for the Open XML SDK&lt;/A&gt;. We look forward to hearing from you. &lt;/P&gt;
&lt;P&gt;Zeyad Rajabi&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9936805" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Extending the Reach of Excel Services with the Open XML SDK</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/12/03/extending-the-reach-of-excel-services-with-the-open-xml-sdk.aspx</link><pubDate>Thu, 03 Dec 2009 21:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9932202</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9932202</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/12/03/extending-the-reach-of-excel-services-with-the-open-xml-sdk.aspx#comments</comments><description>&lt;p&gt;&lt;em&gt;Note: Updated post to point to a YouTube video that is shorter than 10 minutes&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;In Brian's last blog he talked about &lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx"&gt;Open XML and Office Services&lt;/a&gt; as a one-two punch to complete many types of solutions. I am going to start writing some posts that showcase these two technologies working together. Excel is a great tool for connecting to multiple types of data sources, like databases or XML files. Unfortunately, Excel has no concept of connecting to other types of Office documents, like Word files. This fact is important because information workers are pumping out more and more Office documents that contain lots of relevant business data. These documents are becoming just as important as data contained within databases. In today's post, I am going to show you how to extend the reach of &lt;a href="http://blogs.msdn.com/excel/archive/2009/10/21/more-updates-from-spc.aspx" mce_href="http://blogs.msdn.com/excel/archive/2009/10/21/more-updates-from-spc.aspx"&gt;Excel Services&lt;/a&gt; and hosted charts to gather data from within a library of Word documents. &lt;/p&gt;  &lt;p&gt;If you want to jump straight into the code, feel free to download this solution &lt;a href="http://zeyadrajabi.members.winisp.net/sourcecode/ExcelServices.zip" mce_href="http://zeyadrajabi.members.winisp.net/sourcecode/ExcelServices.zip"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/_oyF9-TRcAs&amp;amp;hl=en&amp;amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/_oyF9-TRcAs&amp;amp;hl=en&amp;amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;  &lt;h2&gt;Scenario &lt;/h2&gt;  &lt;p&gt;As a Program Manager (PM) in Office, one of our tasks is to write specifications for features that we are designing for the product. These specifications exist in different stages depending on how far along we are in the design. For example, a stage 0 specification is essentially just a placeholder document with no content. A stage 5 specification is a document that contains the full design for a feature and is ready to be coded by developers. Along the way we inevitably run into open issues that must be addressed before the feature can be coded properly. In order to help us track open issues within a document we included a custom style called &amp;quot;Issue&amp;quot; as part of our specification template. This style applies a yellowish background color to a paragraph so that the paragraph easily sticks out. Here is a screenshot of what this style looks like: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image.png" mce_href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb.png" width="626" height="348" mce_src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Whenever a PM encounters an open issue he/she applies this custom style to the content within the specification. Wouldn't it be great if you can generate a dynamic chart that shows the number of open issues for every PM per given specification stage? This chart would represent the relative health of a particular specification library. &lt;/p&gt;  &lt;h2&gt;Solution &lt;/h2&gt;  &lt;p&gt;The scenario I listed above talks about interrogating a repository of Word documents and counting the number of open issues within each of the documents. In order to accomplish this scenario we will need to take the following actions: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Create a template Excel spreadsheet that represents the look and feel of the chart we want to display &lt;/li&gt;    &lt;li&gt;Add an Excel Services web part to a SharePoint site that displays a chart hosted in our template Excel spreadsheet &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;For every Word document in a SharePoint library find the following information: &lt;/div&gt;      &lt;ol&gt;       &lt;li&gt;Program Manager name assigned to the specification &lt;/li&gt;        &lt;li&gt;Specification stage &lt;/li&gt;        &lt;li&gt;The number of open issues within the specification &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;When all the data has been gathered, inject the data into the appropriate location in the template Excel spreadsheet &lt;/li&gt;    &lt;li&gt;     &lt;div&gt;Create a web part button that allows users to refresh the chart (the refresh button will perform steps 3 and 4) &lt;/div&gt;      &lt;ol&gt;       &lt;li&gt;I am going to skip on showing this part since the link to my solution includes source code that shows you how to do this task &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;The Template &lt;/h2&gt;  &lt;p&gt;For the sake of this post and the scenario described above I have created the following template Excel spreadsheet: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_3.png" mce_href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_3.png" width="642" height="528" mce_src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_3.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This spreadsheet contains only one sheet with a blank chart. The chart will display the number of open issues across all the program managers listed within a SharePoint library broken down by the specification status. The chart is given a specific name so that we can reference it within our Excel Services web part. Add this template document to a SharePoint library. &lt;/p&gt;  &lt;h2&gt;Creating an Excel Services Web Part in SharePoint &lt;/h2&gt;  &lt;p&gt;&lt;em&gt;Note: I am going to show you how to create a web part within SharePoint 2010, but you should be able to do the same thing within SharePoint 2007 (since Excel Services is not new to 2010). &lt;/em&gt;&lt;/p&gt;  &lt;p&gt;On a SharePoint site where you are an admin, click on the menu command with your name and select Personalize this Page option: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_4.png" mce_href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_4.png" width="652" height="420" mce_src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_4.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;At this point you have the ability to change the look of the page. Click on the Add a Web Part link: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_5.png" mce_href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_5.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_5.png" width="660" height="566" mce_src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_5.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;In the Categories section select Office Client Applications. In the Web Parts section select Excel Web Access: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_6.png" mce_href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_6.png" width="672" height="430" mce_src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_6.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now we need to link our Excel Services web part to our template Excel spreadsheet. Click the link to open the tool pane, which allows you to reference the correct Excel spreadsheet. In the Excel Services web part properties pane add the following information: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Name of the referenced workbook &lt;/li&gt;    &lt;li&gt;Name of the chart to be added in the Named Item field &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_7.png" mce_href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_7.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_7.png" width="680" height="492" mce_src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_7.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;At this point we have an Excel Services web part that shows the chart in our Excel spreadsheet template. &lt;/p&gt;  &lt;h2&gt;Gathering Data from a Library of Word Documents &lt;/h2&gt;  &lt;p&gt;The first step in this task is to iterate through all the Word documents in a given specification library. Here is a code snippet to accomplish this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 539px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SPWeb&lt;/span&gt; myWebSite = &lt;span style="color: #2b91af"&gt;SPContext&lt;/span&gt;.Current.Web; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SPDocumentLibrary&lt;/span&gt; specLibrary = myWebSite &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;.Lists[&lt;span style="color: #a31515"&gt;&amp;quot;Sample Spec Library&amp;quot;&lt;/span&gt;] &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SPDocumentLibrary&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Read all Word documents in the library&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SPListItem&lt;/span&gt; item &lt;span style="color: blue"&gt;in&lt;/span&gt; specLibrary.Items) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;byte&lt;/span&gt;[] byteArray = item.File.OpenBinary(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt; mem = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;mem.Write(byteArray, &lt;span style="color: brown"&gt;0&lt;/span&gt;, (&lt;span style="color: blue"&gt;int&lt;/span&gt;)byteArray.Length); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Read the Word document into the Open XML SDK&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt; myDoc = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt;.Open(mem, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Do something&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;Now that we have access to the Word documents we need to count the number of paragraphs that have the style &amp;quot;Issue&amp;quot; applied. I have already written a post on how to accomplish this task. Check out &lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/05/05/retrieving-word-content-based-on-styles.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/05/05/retrieving-word-content-based-on-styles.aspx"&gt;retrieving Word content based on styles&lt;/a&gt;. I am going to reuse the same methods I talked about in that previous post for this scenario. I will reuse the method called &lt;span style="font-family: consolas; font-size: 10pt"&gt;GetParagraphListByStyle&lt;/span&gt;, which returns a list of paragraphs given a main document part and a specific style name. &lt;/p&gt;  &lt;p&gt;Gathering the PM associated with the specification and the spec status is a matter of retrieving content within a specific content control. In my solution I am going to store the PM name, the number of open issues in the specification and the status of the specification within a hash table. Here is the code snippet I used to store the information: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 557px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;Hashtable&lt;/span&gt; specTable = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Hashtable&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&amp;#160;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Read all Word documents in the library&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SPListItem&lt;/span&gt; item &lt;span style="color: blue"&gt;in&lt;/span&gt; specLibrary.Items) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; pmName = &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; numOpenIssues = &lt;span style="color: brown"&gt;0&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; status = &lt;span style="color: brown"&gt;0&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;... &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Read the Word document into the Open XML SDK&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt; myDoc = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WordprocessingDocument&lt;/span&gt;.Open(mem, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;MainDocumentPart&lt;/span&gt; mainPart = myDoc.MainDocumentPart; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Find out the program manager name associated with the spec&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;Word.&lt;span style="color: #2b91af"&gt;DataBinding&lt;/span&gt; binding = mainPart.Document &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;.Descendants&amp;lt;Word.&lt;span style="color: #2b91af"&gt;DataBinding&lt;/span&gt;&amp;gt;() &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;.Where(d =&amp;gt; d.XPath.Value.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;PM2&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;.First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;pmName = binding.Ancestors&amp;lt;Word.&lt;span style="color: #2b91af"&gt;SdtCell&lt;/span&gt;&amp;gt;().First().InnerText; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Get all paragraphs in the spec that have a style &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//applied on the paragraphs called &amp;quot;Issue&amp;quot;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;Word.&lt;span style="color: #2b91af"&gt;Paragraph&lt;/span&gt;&amp;gt; paraIssueList = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;GetParagraphListByStyle(mainPart, &lt;span style="color: #a31515"&gt;&amp;quot;Issue&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;numOpenIssues = paraIssueList.Count(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Find out the spec status (either 0, 1, 2, 3, 4, or 5)&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;Word.&lt;span style="color: #2b91af"&gt;Paragraph&lt;/span&gt;&amp;gt; paraSpecStatusList = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;GetParagraphListByStyle(mainPart, &lt;span style="color: #a31515"&gt;&amp;quot;SpecStatus&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (Word.&lt;span style="color: #2b91af"&gt;Paragraph&lt;/span&gt; p &lt;span style="color: blue"&gt;in&lt;/span&gt; paraSpecStatusList) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; specStatus = p.InnerText; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (specStatus.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;0&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;status = &lt;span style="color: brown"&gt;0&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt; &lt;span style="color: blue"&gt;if&lt;/span&gt; (specStatus.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;status = &lt;span style="color: brown"&gt;1&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt; &lt;span style="color: blue"&gt;if&lt;/span&gt; (specStatus.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;2&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;status = &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt; &lt;span style="color: blue"&gt;if&lt;/span&gt; (specStatus.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;3&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;status = &lt;span style="color: brown"&gt;3&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt; &lt;span style="color: blue"&gt;if&lt;/span&gt; (specStatus.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;4&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;status = &lt;span style="color: brown"&gt;4&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt; &lt;span style="color: blue"&gt;if&lt;/span&gt; (specStatus.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;5&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;status = &lt;span style="color: brown"&gt;5&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Once we find all the data lets add it to a hashtable&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//We will use this data to build up our chart&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (specTable.Contains(pmName)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt;[] specStatusValues = (&lt;span style="color: blue"&gt;int&lt;/span&gt;[])specTable[pmName]; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;specStatusValues[status] += numOpenIssues; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt;[] specStatusValues = { &lt;span style="color: brown"&gt;0&lt;/span&gt;, &lt;span style="color: brown"&gt;0&lt;/span&gt;, &lt;span style="color: brown"&gt;0&lt;/span&gt;, &lt;span style="color: brown"&gt;0&lt;/span&gt;, &lt;span style="color: brown"&gt;0&lt;/span&gt;, &lt;span style="color: brown"&gt;0&lt;/span&gt; }; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;specStatusValues[status] += numOpenIssues; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;specTable.Add(pmName, specStatusValues); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;Notice that the specification status can be one of six values, from Stage 0 to Stage 5. &lt;/p&gt;  &lt;h2&gt;Adding Data to my Spreadsheet &lt;/h2&gt;  &lt;p&gt;At this point we have all the data from our document library. All that is left is to insert this data into our Excel spreadsheet. This part of the solution is analogous to my previous post on &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/11/04/document-assembly-solution-for-spreadsheetml.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2008/11/04/document-assembly-solution-for-spreadsheetml.aspx"&gt;document assembly for SpreadsheetML&lt;/a&gt;. We are simply going to create new rows and cells in our spreadsheet for every piece of data within our hash table. Notice that we are adding two types of cells: value based cells and text based cells. These two types of cells are stored differently in Excel. Here is the code snippet used to accomplish this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 696px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;void&lt;/span&gt; AddDataToExcel(&lt;span style="color: #2b91af"&gt;Hashtable&lt;/span&gt; specTable) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SPWeb&lt;/span&gt; myWebsite = &lt;span style="color: #2b91af"&gt;SPContext&lt;/span&gt;.Current.Web; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SPDocumentLibrary&lt;/span&gt; templateLibrary = myWebsite &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;.Lists[&lt;span style="color: #a31515"&gt;&amp;quot;Excel Template&amp;quot;&lt;/span&gt;] &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SPDocumentLibrary&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SPFile&lt;/span&gt; template = myWebsite &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;.GetFile(&lt;span style="color: #a31515"&gt;@&amp;quot;http://wordteamserver/excelservices/Excel%20Template/template.xlsx&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;template.CopyTo(outputFileName, &lt;span style="color: blue"&gt;true&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SPFile&lt;/span&gt; output = myWebsite.GetFile(template); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;byte&lt;/span&gt;[] byteArray = output.OpenBinary(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Open the output workbook so we can add data to it&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt; mem = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;mem.Write(byteArray, &lt;span style="color: brown"&gt;0&lt;/span&gt;, (&lt;span style="color: blue"&gt;int&lt;/span&gt;)byteArray.Length); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt; myWorkbook = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SpreadsheetDocument&lt;/span&gt;.Open(mem, &lt;span style="color: blue"&gt;true&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Get the first sheet in the workbook&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorkbookPart&lt;/span&gt; workbookPart = myWorkbook.WorkbookPart; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; worksheetPart = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;GetWorkSheetPart(workbookPart, &lt;span style="color: #a31515"&gt;&amp;quot;Sheet1&amp;quot;&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Sheet data contains all the data in the rows/cells&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;SpreadSheet.&lt;span style="color: #2b91af"&gt;SheetData&lt;/span&gt; sheetData = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;worksheetPart.Worksheet.GetFirstChild&amp;lt;SpreadSheet.&lt;span style="color: #2b91af"&gt;SheetData&lt;/span&gt;&amp;gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Go through our spec hashtable so we can add the data to workbook&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;IDictionaryEnumerator&lt;/span&gt; enumerator = specTable.GetEnumerator(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;while&lt;/span&gt; (enumerator.MoveNext()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; pmName = (&lt;span style="color: blue"&gt;string&lt;/span&gt;)enumerator.Key; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt;[] specStatusValues = (&lt;span style="color: blue"&gt;int&lt;/span&gt;[])enumerator.Value; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//create a new row for each program manager&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;SpreadSheet.&lt;span style="color: #2b91af"&gt;Row&lt;/span&gt; r = &lt;span style="color: blue"&gt;new&lt;/span&gt; SpreadSheet.&lt;span style="color: #2b91af"&gt;Row&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Add a cell to the row with the program manager name&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//note that the name is a string&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;SpreadSheet.&lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt; firstCell = &lt;span style="color: blue"&gt;new&lt;/span&gt; SpreadSheet.&lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;firstCell.DataType = SpreadSheet.&lt;span style="color: #2b91af"&gt;CellValues&lt;/span&gt;.InlineString; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;SpreadSheet.&lt;span style="color: #2b91af"&gt;InlineString&lt;/span&gt; inlineString = &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; SpreadSheet.&lt;span style="color: #2b91af"&gt;InlineString&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;SpreadSheet.&lt;span style="color: #2b91af"&gt;Text&lt;/span&gt; t = &lt;span style="color: blue"&gt;new&lt;/span&gt; SpreadSheet.&lt;span style="color: #2b91af"&gt;Text&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;t.Text = pmName; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;inlineString.Append(t); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;firstCell.Append(inlineString); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;r.Append(firstCell); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Let's add values to the other cells&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//specifically we will add the number of open issues&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//across the different spec status values&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;for&lt;/span&gt; (&lt;span style="color: blue"&gt;int&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt;; i &amp;lt; &lt;span style="color: brown"&gt;6&lt;/span&gt;; i++) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;SpreadSheet.&lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt; sheetCell = &lt;span style="color: blue"&gt;new&lt;/span&gt; SpreadSheet.&lt;span style="color: #2b91af"&gt;Cell&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;SpreadSheet.&lt;span style="color: #2b91af"&gt;CellValue&lt;/span&gt; v = &lt;span style="color: blue"&gt;new&lt;/span&gt; SpreadSheet.&lt;span style="color: #2b91af"&gt;CellValue&lt;/span&gt;(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; textValue = specStatusValues[i].ToString(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;v.Text = textValue; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;sheetCell.Append(v); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 180pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;r.Append(sheetCell); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 144pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;sheetData.Append(r); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;worksheetPart.Worksheet.Save(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Once we have added all the values we need to update the &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//chart ranges&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;FixChartData(worksheetPart, specTable); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Add output file to library&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;SPFolder&lt;/span&gt; fldr = myWebsite.Folders[&lt;span style="color: #a31515"&gt;&amp;quot;Excel Template&amp;quot;&lt;/span&gt;]; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;fldr.Files.Add(outputFileName, mem, &lt;span style="color: blue"&gt;true&lt;/span&gt;); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;p&gt;The GetWorkSheetPart method is the same method I wrote about in my previous post on &lt;a href="http://blogs.msdn.com/brian_jones/archive/2009/02/19/how-to-copy-a-worksheet-within-a-workbook.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/02/19/how-to-copy-a-worksheet-within-a-workbook.aspx"&gt;how to copy a worksheet within a workbook&lt;/a&gt;. &lt;/p&gt;  &lt;h2&gt;Fix Chart Data &lt;/h2&gt;  &lt;p&gt;The last step in the solution is to fix the chart data. Again this code snippet is taken directly from my previous post on &lt;a href="http://blogs.msdn.com/brian_jones/archive/2008/11/04/document-assembly-solution-for-spreadsheetml.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2008/11/04/document-assembly-solution-for-spreadsheetml.aspx"&gt;document assembly for SpreadsheetML&lt;/a&gt;. In any case, here is the code snippet used to accomplish this task: &lt;/p&gt;  &lt;div&gt;   &lt;table style="border-collapse: collapse; background: #dbe5f1" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 616px" /&gt;&lt;/colgroup&gt;&lt;tbody valign="top"&gt;       &lt;tr&gt;         &lt;td style="border-bottom: black 0.5pt solid; border-left: black 0.5pt solid; padding-bottom: 1px; padding-left: 7px; padding-right: 7px; border-top: black 0.5pt solid; border-right: black 0.5pt solid; padding-top: 1px" valign="middle"&gt;           &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Fix the range of the chart data&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;void&lt;/span&gt; FixChartData(&lt;span style="color: #2b91af"&gt;WorksheetPart&lt;/span&gt; worksheetPart, &lt;span style="color: #2b91af"&gt;Hashtable&lt;/span&gt; specTable) &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; totalCount = specTable.Count + &lt;span style="color: brown"&gt;1&lt;/span&gt;; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: #2b91af"&gt;ChartPart&lt;/span&gt; chartPart = worksheetPart.GetPartsOfType&amp;lt;&lt;span style="color: #2b91af"&gt;DrawingsPart&lt;/span&gt;&amp;gt;() &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;.First().ChartParts.First(); &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (Charts.&lt;span style="color: #2b91af"&gt;Formula&lt;/span&gt; formula &lt;span style="color: blue"&gt;in&lt;/span&gt; chartPart.ChartSpace &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;.Descendants&amp;lt;Charts.&lt;span style="color: #2b91af"&gt;Formula&lt;/span&gt;&amp;gt;()) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: green"&gt;//Range needs to be updated such that we reference the number of rows&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (formula.Text.Contains(&lt;span style="color: #a31515"&gt;&amp;quot;$2&amp;quot;&lt;/span&gt;)) &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;{ &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; s = formula.Text.Split(&lt;span style="color: #a31515"&gt;'$'&lt;/span&gt;)[&lt;span style="color: brown"&gt;1&lt;/span&gt;]; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 108pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;formula.Text += &lt;span style="color: #a31515"&gt;&amp;quot;:$&amp;quot;&lt;/span&gt; + s + &lt;span style="color: #a31515"&gt;&amp;quot;$&amp;quot;&lt;/span&gt; + totalCount; &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 72pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;} &lt;/span&gt;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&amp;#160;&lt;/div&gt;            &lt;div style="margin-left: 36pt"&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;chartPart.ChartSpace.Save(); &lt;/span&gt;&lt;/div&gt;            &lt;div&gt;&lt;span style="font-family: consolas; font-size: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h2&gt;End Result &lt;/h2&gt;  &lt;p&gt;Running this code I will end up with a chart that represents the number of open issues across a library of Word documents. Clicking Update Chart will ensure the chart reflects the data contained within the library. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_9.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://zeyadrajabi.members.winisp.net/ExtendingtheReachofExcelServiceswiththeO_BDD8/image_thumb_9.png" width="918" height="677" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I am excited about this solution because it shows how you can extend the reach of our services to accomplish other types of solutions. In this case, having Excel reflect data contained within Word documents. &lt;/p&gt;  &lt;p&gt;Zeyad Rajabi&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9932202" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category></item><item><title>Open XML SDK + Word Automation Services Presentation at PDC</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/11/23/open-xml-sdk-word-automation-services-presentation-at-pdc.aspx</link><pubDate>Mon, 23 Nov 2009 18:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9927445</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9927445</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/11/23/open-xml-sdk-word-automation-services-presentation-at-pdc.aspx#comments</comments><description>&lt;P&gt;I just got back from &lt;A href="http://microsoftpdc.com/" mce_href="http://microsoftpdc.com/"&gt;PDC&lt;/A&gt; and am excited to share with you guys the presentation, deck, and code samples I showed at &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/11/10/open-xml-sdk-sessions-at-the-professional-developers-conference-pdc.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/11/10/open-xml-sdk-sessions-at-the-professional-developers-conference-pdc.aspx"&gt;my session&lt;/A&gt;. I also want to thank everyone who attended my session. Here is my recorded session: &lt;/P&gt; &lt;P&gt;   &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
        width="800" height="450"&gt;         &lt;param name="source" value="http://microsoftpdc.com/Skins/PDC09/Styles/players/VideoPlayer2009_03_27.xap" /&gt;         &lt;param name="initParams" value="m=http://ecn.channel9.msdn.com/o9/pdc09/wmvhigh/PR09.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://microsoftpdc.com/Skins/PDC09/Styles/images/DefaultPlayerBackground.png, postid=0" /&gt;         &lt;param name="background" value="#00FFFFFF" /&gt;         &lt;param name="enableHtmlAccess" value="true" /&gt;         &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;             &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt;         &lt;/a&gt;     &lt;/object&gt;&lt;/P&gt; &lt;P&gt;You can find my session deck here: &lt;A href="http://ecn.channel9.msdn.com/o9/pdc09/ppt/PR09.pptx" mce_href="http://ecn.channel9.msdn.com/o9/pdc09/ppt/PR09.pptx"&gt;http://ecn.channel9.msdn.com/o9/pdc09/ppt/PR09.pptx&lt;/A&gt; &lt;/P&gt; &lt;P&gt;You can find all my code samples for the demos I showed here: &lt;A href="http://zeyadrajabi.members.winisp.net/sourcecode/PDC%20Open%20XML%20demos.zip" mce_href="http://zeyadrajabi.members.winisp.net/sourcecode/PDC%20Open%20XML%20demos.zip"&gt;http://zeyadrajabi.members.winisp.net/sourcecode/PDC%20Open%20XML%20demos.zip&lt;/A&gt; &lt;/P&gt; &lt;P&gt;In Brian's last post, he gave a good &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx"&gt;overview of using the Open XML SDK and Office Services together&lt;/A&gt;. In the next couple of months I am going to start blogging more about scenarios and solutions that leverage both the SDK and Office Services to create rich Office document solutions. &lt;/P&gt; &lt;P&gt;&lt;EM&gt;Note: I am still waiting for &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/10/09/open-xml-sdk-sessions-at-the-sharepoint-conference-spc.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/10/09/open-xml-sdk-sessions-at-the-sharepoint-conference-spc.aspx"&gt;my two sessions at SPC&lt;/A&gt; to get published. As soon as they do, I will share them out with you guys. &lt;/EM&gt;&lt;/P&gt; &lt;P&gt;Zeyad Rajabi&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9927445" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Conferences/">Conferences</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Open XML SDK Sessions at the Professional Developers Conference (PDC)</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/11/10/open-xml-sdk-sessions-at-the-professional-developers-conference-pdc.aspx</link><pubDate>Tue, 10 Nov 2009 23:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9920514</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9920514</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/11/10/open-xml-sdk-sessions-at-the-professional-developers-conference-pdc.aspx#comments</comments><description>&lt;P&gt;I'm pretty excited, next week I'll be at &lt;A href="http://microsoftpdc.com/" mce_href="http://microsoftpdc.com/"&gt;PDC&lt;/A&gt; in Los Angeles giving another presentation on the Open XML SDK. I'll be at the conference from Nov 17-19, so if you're at PDC do come by and say hi. Here's the description and time of the session I'll be presenting: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 159px"&gt;
&lt;COL style="WIDTH: 94px"&gt;
&lt;COL style="WIDTH: 61px"&gt;
&lt;COL style="WIDTH: 483px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR style="BACKGROUND: #4f81bd"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #4f81bd 1pt solid"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;Session Title&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #4f81bd 1pt solid"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;Time &amp;amp; Date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #4f81bd 1pt solid"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;Session Code&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #4f81bd 1pt solid; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;Description&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none"&gt;
&lt;P&gt;&lt;A href="http://microsoftpdc.com/Sessions/PR09" mce_href="http://microsoftpdc.com/Sessions/PR09"&gt;&lt;STRONG&gt;Document Assembly and Manipulation on Microsoft SharePoint Server 2010 Using Word Automation Services and Open&amp;nbsp;XML&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none"&gt;
&lt;P&gt;11/19/2009 11:30AM &lt;/P&gt;
&lt;P&gt;@ 408B&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none"&gt;
&lt;P&gt;PR09&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid"&gt;
&lt;P&gt;Come learn about the Open XML SDK, which provides a set of .NET APIs to help developers create and manipulate documents in the Open XML Formats, and the Microsoft Office services available in SharePoint Server 2010. Hear how Word Automation Services and Excel Services can be used to build solutions for server environments without the need of the Office clients. Come and check out all the demos and free source code.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;Let me know if there are specific demos you would like to see. Besides the presentation, you will be able to find me at the Office client booth during the week of PDC and at the "Ask the Experts" event. I'm looking forward to hearing feedback from you guys at the conference. &lt;/P&gt;
&lt;P&gt;Zeyad Rajabi&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9920514" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Conferences/">Conferences</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category></item><item><title>Open XML and Office Services </title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx</link><pubDate>Tue, 03 Nov 2009 20:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9916952</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9916952</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/11/03/open-xml-and-office-services.aspx#comments</comments><description>&lt;P&gt;If you didn't see the news up on the Word team blog announcing Word Automation Services, and you have any interest in server side conversion of .docx files into .pdf or .xps, you should definitely go take a look: &lt;A href="http://blogs.msdn.com/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx" mce_href="http://blogs.msdn.com/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx"&gt;http://blogs.msdn.com/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx&lt;/A&gt; &lt;/P&gt;
&lt;H1&gt;Capturing Business Processes in Office &lt;/H1&gt;
&lt;P&gt;I see a lot of different types of solutions people build to make their workgroups run more accurately and efficiently. Many of the solutions are created in order to codify one or more pieces of a business process, and as you can imagine, Office plays a huge role in these processes. For example, there may be people using Outlook for communication; Excel for analysis; Word for documentation; and just about any process ends in PowerPoint where you present the results of the work. &lt;/P&gt;
&lt;P&gt;As we see the shift from a focus on an individual's productivity to a focus on the entire workgroup's productivity, it also means the way in which people program against our applications changes. This is why you see a lot more SharePoint development in addition to traditional Office development (I briefly &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/06/01/office-2010-and-how-it-can-help-you-build-powerful-solutions.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/06/01/office-2010-and-how-it-can-help-you-build-powerful-solutions.aspx"&gt;mentioned&lt;/A&gt; this over the summer). It's also why the Open XML formats and the Open XML SDK were such important investments for us… they help the Office applications continue to play an important role in these workgroup level scenarios. &lt;/P&gt;
&lt;H1&gt;Printing and Re-Calcing on the Server &lt;/H1&gt;
&lt;P&gt;For example, one request we've heard from folks working with the Open XML formats on the server is that they want access to some core client functionality, like printing/layout in Word, or calculations in Excel. A couple weeks ago at the SharePoint conference we announced the next version of &lt;A href="http://blogs.msdn.com/excel/archive/2009/10/21/more-updates-from-spc.aspx" mce_href="http://blogs.msdn.com/excel/archive/2009/10/21/more-updates-from-spc.aspx"&gt;Excel Services&lt;/A&gt;, as well as a new service called &lt;A href="http://blogs.msdn.com/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx" mce_href="http://blogs.msdn.com/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx"&gt;Word Automation Services&lt;/A&gt;. These two services are great resources for people doing server side document assembly/manipulation with Open XML. The Open XML formats are great for consuming or generating content for dynamic document assembly scenarios, but often there is also the need to recalc the model, refresh the charts, or print the document, and you don't want to necessarily call back to the client to do this. &lt;/P&gt;
&lt;H1&gt;Server Side Document Assembly Example &lt;/H1&gt;
&lt;P&gt;A quick example to help explain this is a process I've seen a number of times, where banks were trying to do bulk generation of loan applications (thousands a day). There are end users involved in creating the template for the loan application, as well as building out the financial models for how the terms of the loan are determined, but the generation of the individual applications was a bulk server-side process based an incoming list of applicants. The combination of Open XML and content controls makes it pretty easy to create .docx files on the server, but in this scenario the banks wanted to send out either PDFs or hard copies, which meant you needed to include the Word client in the process (and it was obviously the big bottle neck). &lt;/P&gt;
&lt;P&gt;With the new services announced at the SharePoint conference though, you get the perfect mix of software + services to solve the scenario. The end users can continue to work in the applications they are familiar with (Word &amp;amp; Excel) to build out the template and financial model, and the bulk generation can all happen on the server in an automated process: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.jonesxml.com/images/clientServer.png"&gt;&lt;IMG alt="" src="http://www.jonesxml.com/images/clientServerSmall.png" mce_src="http://www.jonesxml.com/images/clientServerSmall.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Here's a quick step by step explanation of the process: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;EM&gt;Client-side&lt;/EM&gt;: Loan Template author generates the template for the loan application, and uses content controls to specify where the data should go. He saves it up to SharePoint so others can collaborate with him. &lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Client-side&lt;/EM&gt;: Folks from the Legal department are able to work with in the document at the same time as the Template author because of the &lt;A href="http://blogs.msdn.com/microsoft_office_word/archive/2009/09/09/co-authoring-in-word-2010.aspx" mce_href="http://blogs.msdn.com/microsoft_office_word/archive/2009/09/09/co-authoring-in-word-2010.aspx"&gt;new co-authoring functionality in Word 2010&lt;/A&gt;. &lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Client-side&lt;/EM&gt;: A financial analyst builds up a model for determining whether an applicant should be considered and what the terms of the loan should be. This model is saved up to SharePoint as an .xlsx &lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Server-side&lt;/EM&gt;: As new applicants request an application, a server side process takes their data, and uses the Open XML SDK to inject it into xlsx. (&lt;A href="http://blogs.msdn.com/brian_jones/archive/2008/11/04/document-assembly-solution-for-spreadsheetml.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2008/11/04/document-assembly-solution-for-spreadsheetml.aspx"&gt;Example 1&lt;/A&gt;; &lt;A href="http://blogs.msdn.com/brian_jones/archive/2008/11/10/reading-data-from-spreadsheetml.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2008/11/10/reading-data-from-spreadsheetml.aspx"&gt;Example 2&lt;/A&gt;) &lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Server&lt;/EM&gt;-side: The financial model (.xlsx) is then sent off to Excel Services to perform calculations and pull out the results &lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Server-side&lt;/EM&gt;: The process takes the results of the calculation, and injects them into the Word template, using the content controls to determine what data should go where, producing a .docx file. (&lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/01/05/taking-advantage-of-bound-content-controls.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/01/05/taking-advantage-of-bound-content-controls.aspx"&gt;Example 1&lt;/A&gt;; &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/01/19/pushing-data-from-a-database-into-a-word-document.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/01/19/pushing-data-from-a-database-into-a-word-document.aspx"&gt;Example 2&lt;/A&gt;) &lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Server-side&lt;/EM&gt;: The .docx file is passed off to Word services where a .pdf file is generated, which can either then be sent on to a high volume printer, or e-mailed directly to the applicant. &lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Client-side&lt;/EM&gt;: Any of the users can make updates to the documents (assuming this is allowed as part of the workflow), and those changes will automatically make their way into the bulk generation process. &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;So, you can see this is a pretty basic but also extremely power scenario, and if you've been reading &lt;A href="http://blogs.msdn.com/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/default.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/default.aspx"&gt;Zeyad's examples&lt;/A&gt; over the past year or so you know how easy this can be with the Open XML SDK. I've been excited about these technologies for a few years now, and it's great that we can finally start talking publicly about them. Zeyad had a couple great demos at the &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/10/21/demos-shown-at-the-sharepoint-conference-spc.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/10/21/demos-shown-at-the-sharepoint-conference-spc.aspx"&gt;SharePoint conference&lt;/A&gt; that really helped show the value of these services in combination with the Open XML formats. We'll post a video of the presentation as soon as it comes available, and will also have separate blog posts that drill into each one over the coming months. &lt;/P&gt;
&lt;P&gt;-Brian&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9916952" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Word/">Word</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Excel/">Excel</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/PDF/">PDF</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category></item><item><title>Migrating your custom solutions to Office 14</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/10/22/migrating-your-custom-solutions-to-office-14.aspx</link><pubDate>Fri, 23 Oct 2009 00:11:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9911774</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9911774</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/10/22/migrating-your-custom-solutions-to-office-14.aspx#comments</comments><description>&lt;p&gt;For those folks who have custom Office solutions within their enterprise, one area that you often need to focus on during the upgrade cycle is testing out those custom solutions to make sure they'll run in the latest version. With Office 14, we're going to provide a great set of tools to make it even easier for folks tasked with deployment. Michael Kiselman provided a great overview today up on Gray Knowlton's blog:  &lt;a href="http://blogs.technet.com/gray_knowlton/archive/2009/10/22/announcing-the-office-2010-application-compatibility-program.aspx"&gt;http://blogs.technet.com/gray_knowlton/archive/2009/10/22/announcing-the-office-2010-application-compatibility-program.aspx&lt;/a&gt;
	&lt;/p&gt;&lt;p&gt;We always focus heavily on testing application compatibility from version to version, and in most cases applications will continue to run just like they did in the older version. From time to time though there are cases where a custom application may need to be updated. The tools Michael describes help with both the discovery and migration processes. 
&lt;/p&gt;&lt;p&gt;-Brian&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9911774" width="1" height="1"&gt;</description></item><item><title>Open XML SDK Demos Shown at the SharePoint Conference (SPC)</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/10/21/demos-shown-at-the-sharepoint-conference-spc.aspx</link><pubDate>Thu, 22 Oct 2009 04:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9911107</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9911107</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/10/21/demos-shown-at-the-sharepoint-conference-spc.aspx#comments</comments><description>&lt;P&gt;First off, I want to thank everyone who attended &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/10/09/open-xml-sdk-sessions-at-the-sharepoint-conference-spc.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/10/09/open-xml-sdk-sessions-at-the-sharepoint-conference-spc.aspx"&gt;my two sessions at SPC&lt;/A&gt; on developing solutions on top of the Open XML SDK. The sessions were recorded, so as soon as they are published to the web I will send you guys some links. In the meantime, I want to share with you guys some really cool demos and source code I presented at the sessions. &lt;/P&gt;
&lt;P&gt;Here is a link to all the demos that I showed, plus a bunch more: &lt;A href="http://zeyadrajabi.members.winisp.net/sourcecode/Open%20XML%20demos.zip" mce_href="http://zeyadrajabi.members.winisp.net/sourcecode/Open%20XML%20demos.zip"&gt;http://zeyadrajabi.members.winisp.net/sourcecode/Open XML demos.zip&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;This zip file includes demos I have already blogged about plus a few new solutions around using the Open XML SDK with Office Services. Expect to see future blog posts for the demos that haven't been blogged about yet. &lt;/P&gt;
&lt;P&gt;Zeyad Rajabi &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9911107" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Conferences/">Conferences</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category></item><item><title>Open XML SDK Sessions at the SharePoint Conference (SPC)</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/10/09/open-xml-sdk-sessions-at-the-sharepoint-conference-spc.aspx</link><pubDate>Fri, 09 Oct 2009 23:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9905610</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9905610</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/10/09/open-xml-sdk-sessions-at-the-sharepoint-conference-spc.aspx#comments</comments><description>&lt;P&gt;We're just a couple of weeks away before the start of the &lt;A href="http://www.mssharepointconference.com/" mce_href="http://www.mssharepointconference.com"&gt;SharePoint Conference&lt;/A&gt; (SPC) being held in Las Vegas. I want to give you guys a heads up that I will be at the conference from Oct 19-22. I'm pretty excited because I will be giving two different presentations on the Open XML SDK at the conference. Here's the description and times of the two sessions I'll be doing: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 162px"&gt;
&lt;COL style="WIDTH: 138px"&gt;
&lt;COL style="WIDTH: 60px"&gt;
&lt;COL style="WIDTH: 479px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR style="BACKGROUND: #4f81bd"&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: #7ba1ce 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #7ba1ce 1pt solid; BORDER-RIGHT: medium none"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;Session Title&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #7ba1ce 1pt solid; BORDER-RIGHT: medium none"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;Time &amp;amp; Date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #7ba1ce 1pt solid; BORDER-RIGHT: medium none"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;Session Code&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: #7ba1ce 1pt solid; BORDER-RIGHT: #7ba1ce 1pt solid"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: white"&gt;&lt;STRONG&gt;Description&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="BACKGROUND: #d3e0ef"&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: #7ba1ce 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: medium none"&gt;
&lt;P&gt;&lt;STRONG&gt;SharePoint 2010 Based Document Assembly and Manipulation using Word Automation Services and Open XML&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: medium none"&gt;
&lt;P&gt;10/20/2009 10:30 AM &lt;/P&gt;
&lt;P&gt;@ Mandalay Bay H&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: medium none"&gt;
&lt;P&gt;SPC349&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #7ba1ce 1pt solid"&gt;
&lt;P&gt;The Open XML Formats are the new default file formats for Word, Excel and PowerPoint (docx, xlsx, pptx). With the Open XML SDK, which provides a set of .NET APIs that allows developers to create and manipulate documents in the Open XML Formats, and the Office services available on SharePoint 2010 (Word Automation Services, which performs high-performance bulk document conversions, and Excel Services, which provides server-side support for spreadsheet calculation), developers can now build solutions for server environments without the need of the Office clients. With just a few lines of code you will be able to create rich solutions, like document assembly. Come and check out all the demos and free source code.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: #7ba1ce 1pt solid; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: medium none"&gt;
&lt;P&gt;&lt;STRONG&gt;Deep Dive Open XML and the Open XML SDK&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: medium none"&gt;
&lt;P&gt;10/20/2009 1:15 PM &lt;/P&gt;
&lt;P&gt;@ Mandalay Bay J&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: medium none"&gt;
&lt;P&gt;SPC402&lt;/P&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #7ba1ce 1pt solid; BORDER-LEFT: medium none; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: medium none; BORDER-RIGHT: #7ba1ce 1pt solid"&gt;
&lt;P&gt;This session will introduce you to Open XML and the tools you use to develop Office document solutions. Using Open XML you have the power to create and edit documents on the server without needing to resort to COM based Office automation. You will get a basic understanding of how to use Open XML for authoring documents, spreadsheets and presentations. You will learn how to leverage the Open XML SDK and other various tools to make your development life easier. After this session is complete you will know everything you need to get going with building document automation processes. Come and check out all the demos and free source code.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;Let me know if there are specific demos you guys would like to see and I'll try to work on getting them included. After my presentations, I will make available all my demos and source code on this blog. Besides the presentations, you will be able to find me at the Office client booth during the week of SPC and at the "Ask the Experts" event on Wednesday October 21. If you're at SPC do come by and say hello. I always look forward to hearing feedback from you guys at these conferences. &lt;/P&gt;
&lt;P&gt;Zeyad Rajabi &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9905610" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Conferences/">Conferences</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Finding Open XML Errors with Open XML SDK Validation</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/09/24/finding-open-xml-errors-with-open-xml-sdk-validation.aspx</link><pubDate>Fri, 25 Sep 2009 00:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9899161</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9899161</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/09/24/finding-open-xml-errors-with-open-xml-sdk-validation.aspx#comments</comments><description>&lt;P&gt;In a previous post, I gave you an &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/08/27/announcing-the-release-of-the-august-2009-ctp-for-the-open-xml-sdk.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/08/27/announcing-the-release-of-the-august-2009-ctp-for-the-open-xml-sdk.aspx"&gt;overview of the functionality added to the Open XML SDK 2.0 August 2009 CTP&lt;/A&gt;. Today, I want to deep dive into the schema and semantic level validation support within the SDK. Specifically, I am going to show you guys the Open XML SDK code needed to actually validate your Open XML files. &lt;/P&gt;
&lt;P&gt;If you've played around with manipulating Open XML files there is a good chance at one point in time your resulting document was considered invalid or corrupt by the applications. You've probably even seen one of these dialogs: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://zeyadrajabi.members.winisp.net/Validationimage001.png"&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://zeyadrajabi.members.winisp.net/Validationimage002.png"&gt;&lt;/P&gt;
&lt;P&gt;What do you do when you get into this state? A lot of the time the application error dialogs don't really help you debug the issue. Well, that's where the Open XML SDK can help you out. With just a few lines of code you can identify key pieces of information that tell you what the error is and where to find it within the package. Validation with the Open XML SDK 2.0 is accomplished via the &lt;SPAN style="FONT-FAMILY: Courier New; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;OpenXmlValidator&lt;/SPAN&gt; class. This class allows you to enumerate all the errors within a file, where each error is represented via the &lt;SPAN style="FONT-FAMILY: Courier New; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;ValidationErrorInfo &lt;/SPAN&gt;class. The &lt;SPAN style="FONT-FAMILY: Courier New; COLOR: #2b91af; FONT-SIZE: 10pt"&gt;ValidationErrorInfo &lt;/SPAN&gt;class stores the following information: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;User friendly description of the error &lt;/LI&gt;
&lt;LI&gt;An XPath to the exact location of the error &lt;/LI&gt;
&lt;LI&gt;The part where this error exists &lt;/LI&gt;
&lt;LI&gt;Other elements or parts that are related to this error &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Here is a code snippet you can reuse to validate Word documents: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 638px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;try &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;OpenXmlValidator&lt;/SPAN&gt; validator = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;OpenXmlValidator&lt;/SPAN&gt;(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; count = 0; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ValidationErrorInfo&lt;/SPAN&gt; error &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; validator.Validate(&lt;SPAN style="COLOR: #2b91af"&gt;WordprocessingDocument&lt;/SPAN&gt;.Open(&lt;SPAN style="COLOR: #a31515"&gt;"InvalidFile.docx"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;))) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;count++; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Error "&lt;/SPAN&gt; + count); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Description: "&lt;/SPAN&gt; + error.Description); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Path: "&lt;/SPAN&gt; + error.Path.XPath); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Part: "&lt;/SPAN&gt; + error.Part.Uri); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"-------------------------------------------"&lt;/SPAN&gt;); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.ReadKey(); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;} &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;catch&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;Exception&lt;/SPAN&gt; ex) &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;{ &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(ex.Message); &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;The same code can be used to validate Excel and PowerPoint documents. All you need to do is change the Open method to be one of the following: &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 638px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ValidationErrorInfo&lt;/SPAN&gt; error &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; validator.Validate(&lt;SPAN style="COLOR: #2b91af"&gt;PresentationDocument&lt;/SPAN&gt;.Open(&lt;SPAN style="COLOR: #a31515"&gt;"InvalidFile.pptx"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;or &lt;/P&gt;
&lt;DIV&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 638px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ValidationErrorInfo&lt;/SPAN&gt; error &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; validator.Validate(&lt;SPAN style="COLOR: #2b91af"&gt;SpreadsheetDocument&lt;/SPAN&gt;.Open(&lt;SPAN style="COLOR: #a31515"&gt;"InvalidFile.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;)))&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;Pretty simple stuff! If you want to jump straight into the code, feel free to download this solution &lt;A href="http://zeyadrajabi.members.winisp.net/sourcecode/Validation.zip" mce_href="http://zeyadrajabi.members.winisp.net/sourcecode/Validation.zip"&gt;here&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;Let's walk through an example of validating and fixing an example &lt;A href="http://zeyadrajabi.members.winisp.net/InvalidFile.docx" mce_href="http://zeyadrajabi.members.winisp.net/InvalidFile.docx"&gt;corrupt Word document&lt;/A&gt;. Given this corrupt document, the Open XML SDK detects the following errors: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://zeyadrajabi.members.winisp.net/Validationimage003.png"&gt;&lt;/P&gt;
&lt;P&gt;Let's look at each of these errors. &lt;/P&gt;
&lt;H2&gt;Error 1 &lt;/H2&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Description&lt;/STRONG&gt;: The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:rsidR' has invalid value '006B4C'. The actual length according to datatype 'hexBinary' is not equal to the specified length. The expected length is 4. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Path&lt;/STRONG&gt;: /w:document[1]/w:body[1]/w:p[1] &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Part&lt;/STRONG&gt;: /word/document.xml &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Let's take a look at the xml within the main document part: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://zeyadrajabi.members.winisp.net/Validationimage004.png"&gt;&lt;/P&gt;
&lt;P&gt;The error indicates that the length of the value for &lt;SPAN style="FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 10pt"&gt;rsidR &lt;/SPAN&gt;is not correct. We can fix this issue by changing the value to &lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;00006B4C&lt;/SPAN&gt;. &lt;/P&gt;
&lt;H2&gt;Error 2 &lt;/H2&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Description&lt;/STRONG&gt;: Element 'DocumentFormat.OpenXml.Wordprocessing.Footnote' referenced by 'footnoteReference@id' does not exist in part '/word/footnotes.xml'. The reference value is '3'. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Path&lt;/STRONG&gt;: /w:document[1]/w:body[1]/w:p[6]/w:r[2]/w:footnoteReference[1] &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Part&lt;/STRONG&gt;: /word/document.xml &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Let's take a look at the xml within the main document part: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://zeyadrajabi.members.winisp.net/Validationimage005.png"&gt;&lt;/P&gt;
&lt;P&gt;Let's take a look at the xml within the footnotes part: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://zeyadrajabi.members.winisp.net/Validationimage006.png"&gt;&lt;/P&gt;
&lt;P&gt;The error indicates that there is a reference to a footnote using the value "&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;3&lt;/SPAN&gt;", but no such value exists in the footnotes part. Let's go ahead and change the &lt;SPAN style="FONT-FAMILY: Courier New; COLOR: #a31515; FONT-SIZE: 10pt"&gt;footnoteReference&lt;/SPAN&gt; to have a value of "&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;2&lt;/SPAN&gt;". &lt;/P&gt;
&lt;H2&gt;Error 3 &lt;/H2&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Description&lt;/STRONG&gt;: Attribute 'id' should have unique value. Its current value '1' duplicates with others. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Path&lt;/STRONG&gt;: /w:endnotes[1]/w:endnote[4] &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Part&lt;/STRONG&gt;: /word/endnotes.xml &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Let's take a look at the xml within the endnotes part: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://zeyadrajabi.members.winisp.net/Validationimage007.png"&gt;&lt;/P&gt;
&lt;P&gt;The error indicates that that more than one endnote specify the same &lt;SPAN style="FONT-FAMILY: Courier New; COLOR: red; FONT-SIZE: 10pt"&gt;id &lt;/SPAN&gt;value. Let's go ahead and change the values to be unique. &lt;/P&gt;
&lt;H2&gt;End Result &lt;/H2&gt;
&lt;P&gt;After making these fixes we should be able to open the fixed document with no issues as shown below: &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://zeyadrajabi.members.winisp.net/Validationimage008.png"&gt;&lt;/P&gt;
&lt;P&gt;Try out the validation functionality and let us know what you think. &lt;/P&gt;
&lt;P&gt;Zeyad Rajabi&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9899161" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Word/">Word</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2007/">Office 2007</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Excel/">Excel</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/PowerPoint/">PowerPoint</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/WordprocessingML/">WordprocessingML</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/SpreadsheetML/">SpreadsheetML</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Open XML SDK Code Snippets</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/09/17/open-xml-sdk-code-snippets.aspx</link><pubDate>Thu, 17 Sep 2009 22:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9896471</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9896471</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/09/17/open-xml-sdk-code-snippets.aspx#comments</comments><description>&lt;P&gt;In my &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/08/27/announcing-the-release-of-the-august-2009-ctp-for-the-open-xml-sdk.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/08/27/announcing-the-release-of-the-august-2009-ctp-for-the-open-xml-sdk.aspx"&gt;previous post&lt;/A&gt;, I announced the release of the &lt;A href="http://go.microsoft.com/fwlink/?LinkId=127912" mce_href="http://go.microsoft.com/fwlink/?LinkId=127912"&gt;Open XML SDK August 2009 CTP&lt;/A&gt;. Today, I want to announce the release of the &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=78bea298-a3f9-44cf-bde0-b4f30dc986df&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=78bea298-a3f9-44cf-bde0-b4f30dc986df&amp;amp;displaylang=en"&gt;Open XML SDK code snippets&lt;/A&gt;. This package of code snippets provides over fifty reusable code samples, in both C# and VB.NET, which accomplish many common tasks involving Excel, PowerPoint, or Word documents. Looking back at the architecture diagram for the Open XML SDK 2.0, these code snippets are part of the high level helper functions: &lt;/P&gt;
&lt;P&gt;&lt;IMG alt="Architecture diagram" src="http://zeyadrajabi.members.winisp.net/architecture.png"&gt;&lt;/P&gt;
&lt;P&gt;Erika Ehrli provided a quick summary on all the code snippets in the following &lt;A href="http://blogs.msdn.com/erikaehrli/archive/2009/08/28/open-xml-sdk-2-0-august-ctp-and-50-open-xml-code-samples.aspx" mce_href="http://blogs.msdn.com/erikaehrli/archive/2009/08/28/open-xml-sdk-2-0-august-ctp-and-50-open-xml-code-samples.aspx"&gt;post&lt;/A&gt;. &lt;/P&gt;
&lt;H2&gt;Using the Open XML SDK Code Snippets &lt;/H2&gt;
&lt;P&gt;Let's walk through a quick example of using the Open XML SDK code snippets. In this example, we are given a spreadsheet with a table of data and are asked to read and change a particular cell value. Here is a screenshot of the spreadsheet: &lt;/P&gt;
&lt;P&gt;&lt;IMG alt="Spreadsheet example" src="http://zeyadrajabi.members.winisp.net/spread1.png"&gt;&lt;/P&gt;
&lt;P&gt;Let's say we are asked to read the value of C4 and then change the value from "Austin" to "Houston". &lt;/P&gt;
&lt;P&gt;Here is how you would accomplish this scenario using the Open XML SDK code snippets and the Open XML SDK 2.0: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a solution in Visual Studio 2008 &lt;/LI&gt;
&lt;LI&gt;Add references to the Open XML SDK 2.0 (DocumentFormat.OpenXml.dll) and WindowsBase.dll &lt;/LI&gt;
&lt;LI&gt;Enable the code snippets for your solution by following &lt;A href="http://msdn.microsoft.com/en-us/library/9ybhaktf.aspx" mce_href="http://msdn.microsoft.com/en-us/library/9ybhaktf.aspx"&gt;these steps&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;To read a cell value, add a new method to your solution based on the Open XML SDK code snippets. In particular, add the "&lt;STRONG&gt;Excel: Get cell value given row and column&lt;/STRONG&gt;" code snippet, which retrieves a cell value given its row and column numbers, or a row number and column name &lt;/LI&gt;
&lt;LI&gt;Use the following code to read and display the value for C4: 
&lt;DIV style="MARGIN-LEFT: 5pt"&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 638px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; c4Value = XLGetCellValueRowCol(&lt;SPAN style="COLOR: #a31515"&gt;"output.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"C"&lt;/SPAN&gt;, 4); &lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"The value for C4 is: "&lt;/SPAN&gt; + c4Value);&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;To change a cell value, add a new method to your solution based on the "&lt;STRONG&gt;Excel: Insert string into cell&lt;/STRONG&gt;" code snippet, which given a document name, a worksheet name, a cell name, and a value, inserts text into the specified cell &lt;/LI&gt;
&lt;LI&gt;Use the following code to change the value of C4 to "Houston" &lt;/LI&gt;&lt;/OL&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse; BACKGROUND: #dbe5f1" border=0&gt;
&lt;COLGROUP&gt;
&lt;COL style="WIDTH: 638px"&gt;&lt;/COLGROUP&gt;
&lt;TBODY vAlign=top&gt;
&lt;TR&gt;
&lt;TD style="BORDER-BOTTOM: black 0.5pt solid; BORDER-LEFT: black 0.5pt solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; BORDER-TOP: black 0.5pt solid; BORDER-RIGHT: black 0.5pt solid; PADDING-TOP: 1px" vAlign=center&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;XLInsertStringIntoCell(&lt;SPAN style="COLOR: #a31515"&gt;"output.xlsx"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"Sheet1"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"C4"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"Houston"&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;P&gt;At the end of step #7 we end up with the following Excel spreadsheet: &lt;/P&gt;
&lt;P&gt;&lt;IMG alt="Spreadsheet end result" src="http://zeyadrajabi.members.winisp.net/spread2.png"&gt;&lt;/P&gt;
&lt;P&gt;Pretty easy with the code snippets! If you are interested in the full solution you can find it &lt;A href="http://zeyadrajabi.members.winisp.net/sourcecode/CodeSnippetExample.zip" mce_href="http://zeyadrajabi.members.winisp.net/sourcecode/CodeSnippetExample.zip"&gt;here&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;Zeyad Rajabi&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9896471" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2007/">Office 2007</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Code+Samples/">Code Samples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/SpreadsheetML/">SpreadsheetML</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Zeyad_2700_s+SDK+Examples/">Zeyad's SDK Examples</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item><item><title>Announcing the Release of the August 2009 CTP for the Open XML SDK</title><link>http://blogs.msdn.com/b/brian_jones/archive/2009/08/27/announcing-the-release-of-the-august-2009-ctp-for-the-open-xml-sdk.aspx</link><pubDate>Thu, 27 Aug 2009 16:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9887075</guid><dc:creator>I'm Brian Jones</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/brian_jones/rsscomments.aspx?WeblogPostID=9887075</wfw:commentRss><comments>http://blogs.msdn.com/b/brian_jones/archive/2009/08/27/announcing-the-release-of-the-august-2009-ctp-for-the-open-xml-sdk.aspx#comments</comments><description>&lt;P&gt;I'm really happy to announce the release of the &lt;A href="http://go.microsoft.com/fwlink/?LinkId=127912" mce_href="http://go.microsoft.com/fwlink/?LinkId=127912"&gt;3&lt;SUP&gt;rd&lt;/SUP&gt; CTP for the Open XML SDK 2.0 for Microsoft Office&lt;/A&gt;! So what did we do in this CTP? Well, there were three main improvements we made to the SDK: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Add semantic level validation support &lt;/LI&gt;
&lt;LI&gt;Add markup compatibility/extensibility support &lt;/LI&gt;
&lt;LI&gt;General improvements based on your feedback &lt;/LI&gt;&lt;/OL&gt;
&lt;H2&gt;Semantic Level Validation Support &lt;/H2&gt;
&lt;P&gt;Let's go back to the Open XML SDK architecture diagram I showed you when we first &lt;A href="http://blogs.msdn.com/brian_jones/archive/2008/10/06/open-xml-format-sdk-2-0.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2008/10/06/open-xml-format-sdk-2-0.aspx"&gt;announced the Open XML SDK&lt;/A&gt;: &lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://zeyadrajabi.members.winisp.net/Announcingimage1.png" mce_src="http://zeyadrajabi.members.winisp.net/Announcingimage1.png"&gt; &lt;/P&gt;
&lt;P&gt;As mentioned in a &lt;A href="http://blogs.msdn.com/brian_jones/archive/2009/04/08/announcing-the-release-of-the-open-xml-sdk-version-2-april-2009-ctp.aspx" mce_href="http://blogs.msdn.com/brian_jones/archive/2009/04/08/announcing-the-release-of-the-open-xml-sdk-version-2-april-2009-ctp.aspx"&gt;previous post&lt;/A&gt;, the April 2009 CTP of the Open XML SDK added schema level validation support for Office 2007 Open XML files. In the August 2009 CTP, one of the big things we added is semantic level validation support for Office 2007 Open XML files: &lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://zeyadrajabi.members.winisp.net/Announcingimage2.png" mce_src="http://zeyadrajabi.members.winisp.net/Announcingimage2.png"&gt; &lt;/P&gt;
&lt;P&gt;Semantic level validation goes beyond restrictions or rules defined by schemas. Semantic level validation allows developers to validate files against restrictions defined within the prose of the Open XML documentation. These are restrictions, which cannot be expressed in an XSD language. &lt;/P&gt;
&lt;P&gt;Let's look at a semantic level restriction example. Specifically, let's look at the element &lt;EM&gt;endnote&lt;/EM&gt; (Section 17.11.2 of Part 1 in the &lt;A href="http://www.iso.org/iso/catalogue_detail?csnumber=51463" mce_href="http://www.iso.org/iso/catalogue_detail?csnumber=51463"&gt;ISO/IEC-29500 specification&lt;/A&gt;). In the standard, it states that the &lt;EM&gt;id&lt;/EM&gt; attribute of &lt;EM&gt;endnote&lt;/EM&gt;, "specifies a unique ID which shall be used to match the contents of a footnote or endnote to the associated footnote/endnote reference mark … If more than one footnote shares the same ID, then this document shall be considered non-conformant. If more than one endnote shares the same ID, then this document shall be considered non-conformant." As you can see, having more than one endnote with the same id value will result in a non-conformant document. This non-conformant document may not be interpreted properly by a consuming application, like Word. &lt;/P&gt;
&lt;P&gt;The Open XML SDK can now help you find these types of problems and will report the error to you by giving you the following information: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;DIV&gt;User friendly description of the error &lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;In this case, imagine seeing the following error "Attribute 'id' should have unique value. Its current value '1' duplicates with others." &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;An Xpath to the exact location of the error &lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;In this case, imagine seeing the following path "/w:endnotes[1]/w:endnote[4]," which indicates that the problem exists in the fourth endnote element &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;The part where this error exists &lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;In this case, imagine seeing the following part information "DocumentFormat.OpenXml.Packaging.EndnotesPart" &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;We hope that you can use this type of information to more easily find and fix problems. I will devote at least one blog post in the future to go into details on the validation functionality. &lt;/P&gt;
&lt;H2&gt;Markup Compatibility/Extensibility Support &lt;/H2&gt;
&lt;P&gt;As defined by the &lt;A href="http://www.iso.org/iso/catalogue_detail?csnumber=51461" mce_href="http://www.iso.org/iso/catalogue_detail?csnumber=51461"&gt;ISO/IEC-29500 specification&lt;/A&gt;, there are several ways to extend markup within the Open XML formats. Some of the extension mechanisms, like ignorable content and alternate content blocks, may result in differences within the XML tree structure of a document. Here is an example of markup that contains an alternate content block: &lt;/P&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:document&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;mc:Ignorable&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;w14 wp14&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:body&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:p&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;w:rsidR&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;00FA0A01&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;w:rsidRDefault&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;00AF5A8F&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:r&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:rPr&lt;SPAN style="COLOR: blue"&gt;/&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;mc:AlternateContent&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;mc:Choice&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;Requires&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;wps&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:drawing&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;…… &lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:drawing&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;mc:Choice&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;mc:Fallback&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:pict&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;v:roundrect&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;id&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;Rounded Rectangle 1&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;o:spid&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;_x0000_s1026&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;style&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;position:absolute… &lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;arcsize&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;10923f&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;o:gfxdata&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;…&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;fillcolor&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;#4f81bd&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;strokecolor&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;#385d8a&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;strokeweight&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;2pt&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;v:textbox&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;style&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;mso-rotate-with-shape:t&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 252pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;v:roundrect&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 216pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:pict&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;mc:Fallback&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;mc:AlternateContent&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:r&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:p&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:sectPr&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;w:rsidR&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;00FA0A01&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;…… &lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:sectPr&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:body&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:document&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;In the example above, the expected child of the run element differs depending on the chosen alternate content choice. The fallback choice is what one would expect from a document created in Office 2007, while the choice requiring the wps namespace is from a document created in Office 2010. Imagine you are a solution developer working with Open XML who has deployed a solution that works perfectly on top of Office 2007 Open XML files. How would your solution work with files coming in from Office 2010? Specifically, would your solution work with documents that contain these types of extension mechanisms? &lt;/P&gt;
&lt;P&gt;As part of the August 2009 CTP we have added functionality that allows developers to abstract away some of the difficulty intrinsic with markup compatibility and extensibility. This feature allows you to preprocess the content of Open XML files based on specific Office versions. Using the example above, if we use the August CTP to open the document based on Office 2007 we will only see the following XML markup: &lt;/P&gt;
&lt;DIV&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:document&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:body&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:p&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;w:rsidR&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;00FA0A01&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;w:rsidRDefault&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;00AF5A8F&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:r&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:rPr&lt;SPAN style="COLOR: blue"&gt;/&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:pict&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;v:roundrect&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;id&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;Rounded Rectangle 1&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;o:spid&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;_x0000_s1026&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;style&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;position:absolute… &lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;arcsize&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;10923f&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;o:gfxdata&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;…&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;fillcolor&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;#4f81bd&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;strokecolor&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;#385d8a&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;strokeweight&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;2pt&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;v:textbox&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;style&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;mso-rotate-with-shape:t&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 180pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;v:roundrect&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 144pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:pict&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 108pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:r&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:p&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 72pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;SPAN style="COLOR: #a31515"&gt;w:sectPr&lt;SPAN style="COLOR: blue"&gt; &lt;SPAN style="COLOR: red"&gt;w:rsidR&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;00FA0A01&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;…… &lt;SPAN style="COLOR: blue"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:sectPr&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:body&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="FONT-FAMILY: Courier New; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;SPAN style="COLOR: #a31515"&gt;w:document&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;P&gt;If your solution expected a pict element as a child of a run element, then your solution would work perfectly with this file. In other words, using this feature, solutions won't break when future versions of Office introduce new markup into the format. &lt;/P&gt;
&lt;H2&gt;General Improvements &lt;/H2&gt;
&lt;P&gt;First off we want to thank everyone for their feedback and suggestions! Based on your feedback we made the following big changes to the SDK: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;AutoSave&lt;/STRONG&gt;: By default, previous CTPs of the SDK forced you to perform a manual save for changes made to specific parts within the package. We have now introduced the concept of AutoSave, where changes would automatically be saved into the package, without the need to call Save() methods. For those not interested in this functionality, there is a way to turn off this feature &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Base Classes for Sdt objects&lt;/STRONG&gt;: The SDK currently has multiple classes to represent Sdt objects based on the different types of elements specified in the standard. The August 2009 CTP has introduced one base class for each of these objects in order to make it easier for you to develop solutions. In other words, your solution can now just work on the following abstract class:&amp;nbsp; SdtElement for Sdt objects &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Simple types for Boolean type attributes&lt;/STRONG&gt;: The standard specifies the concept of a simple type called ST_OnOff, which allows for values like "On", "Off", "True", "False", "0", and "1." We have updated the SDK to allow you to directly get/set such attributes using standard C# Boolean values. For example, you can now set attribute values to false or true. Without this enhancement you were forced to compare values using the enum BooleanValues &lt;/LI&gt;&lt;/UL&gt;
&lt;H2&gt;What's Next? &lt;/H2&gt;
&lt;P&gt;Our next task for the SDK is to add Office 2010 Office Open XML support. Expect to see another CTP in the next several months released with this functionality. Our goal is to be done with the Open XML SDK 2.0 around the same time as Office 2010 ships (date not public yet). &lt;/P&gt;
&lt;H2&gt;More Feedback Always Welcome &lt;/H2&gt;
&lt;P&gt;Please continue to send us your feedback, either on this blog or at our Microsoft Connect site for the Open XML SDK &lt;A href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=589" mce_href="https://connect.microsoft.com/site/sitehome.aspx?SiteID=589"&gt;https://connect.microsoft.com/site/sitehome.aspx?SiteID=589&lt;/A&gt;. We look forward to hearing from you. &lt;/P&gt;
&lt;P&gt;Zeyad Rajabi&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9887075" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2007/">Office 2007</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/OpenXML+Developers/">OpenXML Developers</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Open+XML+SDK/">Open XML SDK</category><category domain="http://blogs.msdn.com/b/brian_jones/archive/tags/Office+2010/">Office 2010</category></item></channel></rss>