Open XML SDK

Back to TOCJust VideosCondensed TOC

.NET library for creating, querying, and modifying Open XML documents, spreadsheets, and presentations.

This tutorial shows how to apply the functional transformational approach and LINQ to XML to manipulate XML documents. The C# and Visual Basic examples query and manipulate information in Office Open XML WordprocessingML documents that are saved by Microsoft Word. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
I’ll present some guidance and sample code for creating a document-generation system that uses SharePoint lists to populate tables in an Open XML word-processing document. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  SharePoint 2010  Content Controls  DOCX Generation
This is a blog post series on parameterized Open XML WordprocessingML document generation. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
How to Extract Comments from Open XML Documents (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PresentationML  SpreadsheetML
This blog post has some code that uses the Open XML SDK and LINQ to XML to query an Open XML document. It also is an example of code written in the functional style. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Using the Open XML SDK and LINQ to XML to Remove Comments from an Open XML Wordprocessing Document (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Using the Open XML SDK and LINQ to XML to Remove Personal Information from an Open XML Wordprocessing Document (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Content controls are an effective way to add structure to word processing documents. This post explains how to write a very small LINQ query to retrieve the contents of content controls. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls
Validating Code in Open XML Documents. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Creating Data-Bound Content Controls using the Open XML SDK and LINQ to XML (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls
Merging multiple word processing documents into a single document is something that many people want to do. An application built for attorneys might assemble selected standard clauses into a contract. An application built for book publishers can assemble chapters of a book into a single document. This post explains the semantics of the altChunk element, and provides some code using the Open XML SDK that shows how to use altChunk. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
If you are making a tool to manipulate paragraphs in Open XML Documents, then this post lists some of the constraints that you must pay attention to. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML  DocumentBuilder
A convenient way to explore Open XML markup is to create a small document, modify the document slightly in the Word user interface, save it, and then compare it with the Open XML Diff utility that comes with the Open XML SDK V2. However, Word adds extraneous elements and attributes that enable merging of two documents that have forked. These elements and attributes show up as changed, and obscure the differences that we’re looking for. An easy way to deal with this is to remove these elements and attributes before comparing documents. We can safely do so without changing the content of the document. This post presents a bit of code to do this. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Excel has a very cool feature where you can declare that a range of cells is a table. It is a feature that allows you to use Excel very much like a database. Because these tables are stored in Open XML documents, we can implement some simple extension methods and some classes so that we can query these tables using LINQ in a manner that is similar to querying a SQL database. This post presents a bit of code to do this. (Article)

Keywords:  OpenXML  Open XML SDK  SpreadsheetML
I recently posted some code that allows you to use LINQ to query Excel tables. The source for these queries is the Open XML document – you don’t need to involve the Excel application to query the data in these tables. In that post, I presented a few examples of queries of various types. This post shows a join of two tables using the extension methods and classes presented in that post. (Article)

Keywords:  OpenXML  Open XML SDK  SpreadsheetML
This post explains how to open the Excel spreadsheet, query a database using LINQ to SQL, and project a collection of an anonymous type that contains data from both data sources (Article)

Keywords:  OpenXML  Open XML SDK  SpreadsheetML
Pre-atomizing XName objects enables you to write more reliable code that performs well. (Article)

Keywords:  OpenXML  Open XML SDK  LINQ to XML  XML
Move/Insert/Delete Paragraphs in Word Processing Documents using the Open XML SDK (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML  DocumentBuilder
Finding Paragraphs by Style Name or Content in an Open XML Word Processing Document (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Interrelated Markup in Open XML Word Processing Documents (Article)

Keywords:  OpenXML  Open XML SDK  DocumentBuilder  PowerTools for Open XML  WordprocessingML
An explanation of the issues around interrelated markup that DocumentBuilder (a class in PowerTools for Open XML) solves. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML  DocumentBuilder
This post compares and contrasts two approaches to assemble multiple Open XML word processing documents into a single document (Article)

Keywords:  OpenXML  Open XML SDK  DocumentBuilder  PowerTools for Open XML  WordprocessingML
DocumentBuilder is an example class that’s part of the PowerTools for Open XML project that enables you to assemble new documents from existing documents. DocumentBuilder fixes up interrelated markup when assembling a new document from existing documents. This post shows how to use DocumentBuilder in concert with content controls to control the document assembly. (Article)

Keywords:  OpenXML  Open XML SDK  DocumentBuilder  PowerTools for Open XML  WordprocessingML  Content Controls
Comparison of Navigating Parts between System.IO.Packaging and the Open XML SDK (Article)

Keywords:  OpenXML  Open XML SDK  OPC
Splitting Runs in Open XML Word Processing Document Paragraphs (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Comparing Two Open XML Documents using the Zip Extension Method (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
First post in a series on transforming Open XML WordprocessingML markup to XHtml (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Second post in a series on transforming Open XML WordprocessingML markup to XHtml (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Third post in a series on transforming Open XML WordprocessingML markup to XHtml (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Explores and explains style inheritance in Open XML WordprocessingML (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Compares HTML tables that use CSS styling to tables in Open XML WordprocessingML. Explains significant semantic differences. If you are familiar with HTML tables, this is an easy way to learn about WordprocessingML tables. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
When you want to render a paragraph and its runs inside of a cell, you need to assemble the paragraph and run properties from a number of places. This post details how we assemble styling information from table styles, the formatting directly applied to tables, paragraphs, and runs, and the global default paragraph and run properties.
(Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Revision tracking markup in Open XML word-processing documents is one of the more complex areas of the standard. Accepting tracked revisions makes processing of text in word-processing documents simpler. Learn about the Open XML markup that deals with revision tracking, and how to programmatically accept tracked revisions using the Open XML Format SDK 2.0. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Some XML vocabularies implement a powerful XML pattern that is analogous to inheritance in programming language type systems. Open XML WordprocessingML has these semantics around styles. When you define a new style, you can base this style on another style, and if the new style doesn’t explicitly define some aspect of the style, the new style ‘inherits’ this aspect from its base style. This post presents some code that uses one approach for implementing inheritance semantics. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML  XML  Functional Programming
When implementing a conversion of Open XML word processing documents to HTML, one of the interesting issues is accurately converting numbered and bulleted lists. You must pay special attention to them, because they impact the text that the document contains, but that text isn’t directly in the markup. If you are accurately extracting the text of the document, you must process some elements and attributes to assemble the correct text. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Revision tracking markup in Open XML word-processing documents is one of the more complex areas of the standard. If you first accept tracked revisions, it makes subsequent processing of text in word-processing documents much simpler. As an example, in my current project of transforming Open XML word-processing documents to XHtml, before doing the conversion, I accept tracked revisions in an in-memory WordprocessingDocument object. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
The Microsoft SharePoint Foundation 2010 managed client object model enables you to write applications that are based on the Microsoft .NET Framework that access SharePoint content from clients without installing code on the server that runs SharePoint Foundation 2010. By using these two technologies together you can write client-side applications that work with Open XML documents that are stored in document libraries. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  SharePoint 2010  CSOM
Simplifying Open XML WordprocessingML Queries by First Accepting Revisions (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
As delivered, it is difficult to write entities using LINQ to XML. This post presents a small hack that enables you to serialize XML entities. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML  LINQ to XML  XML
Inserting Content That Contains Images Using altChunk (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Working with Open XML Documents without loading from a file or saving to a file is important when you build applications that work with Microsoft SharePoint Server 2010 or Microsoft ASP.NET Web applications. In addition, some interesting scenarios benefit from creating an in-memory copy of an existing document. Learn how to create and work with in-memory copies of Open XML documents. (Article)

Keywords:  OpenXML  Open XML SDK  OPC  SharePoint 2010
When transforming Open XML markup to another XML vocabulary (such as XHtml), you can sometimes simplify the transform by first transforming the original document to a new, valid WordprocessingML document that contains much simpler markup, and therefore is easier to process. This blog post describes a utility class, MarkupSimplifier, which is part of the PowerTools for Open XML project. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Whenever you write some Open XML SDK code that processes paragraphs based on style name, you need to retrieve the default style name for a document. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Accurately Retrieving Text of a Open XML WordprocessingML Paragraph. (This is one in a series of posts on transforming Open XML WordprocessingML to XHtml.) (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Learn about lists in Open XML. Word 2010 documents often contain numbered and bulleted lists. This area of WordprocessingML is justifiably complex. Numbered lists and bulleted lists have many features, each used by a different set of uses. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Transforming WordprocessingML to Simpler XML for Easier Processing (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Validate Open XML Documents using the Open XML SDK 2.0 (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  SpreadsheetML  PresentationML
LINQ makes programs more maintainable. This post explains why. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
This post lists formats supported for imported content by the altChunk importing functionality of Word. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
On a fairly regular basis, I need to write an example that retrieves an Open XML document from a SharePoint document library, modify the document, and save the document back to the document library. The correct approach is to use a CAML query to retrieve the document. This post presents the minimum amount of code to use the SharePoint object model to do this. (Article)

Keywords:  OpenXML  Open XML SDK  SharePoint 2010  WordprocessingML
Testing for Base Styles in Open XML WordprocessingML Documents (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Using Content Controls to give Semantic Meaning to Content in Open XML WordprocessingML Documents (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls
Transforming Open XML WordprocessingML to XHTML Using the Open XML SDK 2.0 (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Using the Open XML SDK from within a Managed Add-In (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Determining whether an Open XML WordprocessingML document contains tracked revisions is important. You can significantly simplify your code to process Open XML WordprocessingML if you know that the document does not contain tracked revisions. This article describes how to determine whether a document contains tracked revisions. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Understand how to reliably retrieve text from Open XML WordprocessingML documents. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
Learn to use Word Automation Services to do server-side document conversions to and from a variety of document formats. By using the Open XML SDK, you can accomplish tasks that are difficult such as updating the table of contents or repaginating documents. (Article)

Keywords:  OpenXML  Open XML SDK  SharePoint 2010  WordprocessingML  Word Automation Services
This post shows how to search for all content controls in a document, regardless of whether those content controls are in the main document part, in the headers/footers, or in endnotes/footnotes. This example uses LINQ to XML. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
This post presents a summary of the Open XML SpreadsheetML markup that you use to define or query a table. (Article)

Keywords:  OpenXML  Open XML SDK  SpreadsheetML
Create tables with vertically-merged cells in Open XML WordprocessingML documents. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Introduces this blog post series on generating WordprocessingML documents, outlines the goals of the series, and describes various approaches that I may take as I develop some document generation examples. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
This post examines the approaches for building a template document for the document generation process. A template document is a DOCX document that contains content controls that will control the document generation process. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
Discusses enhancements that enable the template designer to write infrastructure code for the document generation process. Also discusses how the document generation process will work. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
This post details my super-simple template system, which will be more than adequate for building this first version of a doc gen system. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls
First version of this document generation system that is driven by C# code that you write in content controls in a Word document. As an intro, he has recorded a small screen-cast that shows the doc gen system in action. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
This is a preliminary version of a simple DOCX generation system, which you can download, unzip, and try. This article lists two screen casts, first 90 second screen-cast shows how to run the doc gen system after you download and unzip the zip file.The second 2 1/2 minute video shows using the document generation system at scale. It shows generating 3000 documents in under a minute. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
In PowerTools, in the HtmlConverter project, there is a class called MarkupSimplifier, which can remove proofing errors. In addition, it can simplify WordprocessingML markup in a variety of ways, including removal of comments, content controls, and etc.
Here is a small screen-cast that shows the use of MarkupSimplifier. This screen-cast uses Open XML Package Editor Power Tool for Visual Studio 2010. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  PowerTools for Open XML
In the following screen cast shows the process of adjusting the XML data that drives the document generation system, as well as adjusting the template document to use that data. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
Introduces the approach of configuring the document generation process by entering XPath expressions in content controls in a template document. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
Importing HTML that contains numbering using altChunk (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
This blog post shows how to update Data in an embedded chart in an Open XML WordprocessingML Document. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
You may have a picture content control where you want to replace the picture with a different picture. This post shows the Open XML SDK V2 code that is necessary to find a picture content control with an alias of “MyPicture”. It then finds the ImagePart, and then replaces the contents of the image part with a different image. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls
In this post, I release V2 of this simple document generation example. I provide a 2-minute screen-cast that shows the document generation process, generating 3000 documents in less than 30 seconds. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
11 minute video that walks through the process of embedding a chart in a word-processing document, and then programmatically updating that data so that the chart reflects the new data. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
This screen-cast shows the general approach that I use to solve Open XML developer problems. The general gist of the approach is that I create two documents, one without the feature of interest, and one with. I then use the Open XML SDK productivity tool to compare the two and find out the differences. I then use the Open XML Package Editor Power Tool for Visual Studio 2010 to examine the markup, and I use the PDF form of the ECMA 376 Second Edition Part 1 to research the markup. (Video)

Keywords:  OpenXML  WordprocessingML  Open XML SDK  Open XML Tools
Describes how to Insert a Page Break between Imported Content. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Sometimes you want to iterate over all content controls in a WordprocessingML document. You may want to search for a content control with a specific tag, or you may want to process all content controls of a specific type. This blog post shows how to iterate over all content controls. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls
7-minute video that shows markup related to protected sheets with locked and unlocked cells. (Article,Video)

Keywords:  OpenXML  Open XML SDK  SpreadsheetML
Three minute screen-cast that demonstrates changing the schema for simple document generation system that you configure by placing XPath expressions in content controls. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML  Content Controls  DOCX Generation
This article describes WinForms Application that makes it easier to research OpenXML markup, by creating documents, altering documents, and then comparing the two documents. The MarkupSimplifier class (which is part of the PowerTools for Open XML project) can help, but as downloaded from CodePlex it is simply a class. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
First video in a two-part series that explains how field markup works. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
See how to use a MarkupSimplifier utility program to make field markup more understandable. In walk through two cases where fields can be embedded in other fields. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
The markup for fields in WordprocessingML documents is fairly involved. This post presents some code to accurately parse field markup. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
This blog has recorded short screen-cast that explores some approaches to setting margins in a word-processing document. It shows setting margins for cells, paragraphs, and sections. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Article has a short screen-cast that shows the markup for various ways of setting margins – for cells, paragraphs, and sections. In addition, the video shows general approach for researching Open XML markup. (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Using XML DOM to Detect Tracked Revisions in an Open XML WordprocessingML Document (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Many developers do not have option of using LINQ to process XML. This post presents a code which uses XML DOM API to detect tracked revisions (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Search and Replace Text in an Open XML WordprocessingML Document (Article,Video)

Keywords:  OpenXML  Open XML SDK  WordprocessingML
Article discusses an approach of creating an Open XML template presentation that you can use to generate multiple presentations from data. (Article,Video)

Keywords:  OpenXML  Open XML SDK  PresentationML  PPTX Generation
You can use Microsoft Office 2010 or the 2007 Microsoft Office system as part of a comprehensive collaboration system. You can send preformatted documents to your customers and extract data and content from those documents after they are returned. This article contains guidance and links to other resources to help you get started. (Article)

Keywords:  OpenXML  Open XML SDK  WordprocessingML