Archive for WordprocessingML

Minor Update to DocumentBuilder 2.0

On June 20, 2011 (two days ago), I posted an update to DocumentBuilder. After more extensive testing, I found and fixed a few bugs in less common scenarios, including if comments in multiple sources contain images, multiple sources contain endnotes with images, and a few other situations. If you have downloaded DocumentBuilder 2.0, please re-download it.


New Version of DocumentBuilder Available in PowerTools for Open XML

At long last, I have completed and posted a much requested and sorely needed update to DocumentBuilder. DocumentBuilder is code that is part of the PowerTools for Open XML project that handles issues of interrelated markup, enabling you to generate new documents from existing documents in a variety of ways. Many more details on


Search and Replace Text in an Open XML WordprocessingML Document

Searching and replacing text in an Open XML WordprocessingML document is not awfully difficult, but there are a few issues that complicate the process.  The text that you are searching for may span multiple runs, so the algorithm that searches for text needs to take this into account.  The replacement text should have the character formatting of the first character of the string in the document that matches the search string.  I’ve written a blog post at that presents the algorithm, as well as example code written using XmlDocument (Microsoft’s implementation of XML DOM).  In addition, I’ve recorded a screen cast that explains the algorithm:

Walks through an algorithm to search and replace text in an Open XML WordprocessingML document.

Comments (21)

Using XML DOM to Detect Tracked Revisions in an Open XML WordprocessingML Document

I’ve written a short article at that shows how to detect tracked revisions using XmlDocument. Previously, I wrote an article on detecting tracked revisions using LINQ to XML or the strongly-typed object model of the Open XML SDK 2.0. However, some developers do not have the option of using LINQ, and instead must use one of a variety of XML DOM Document implementations. The article presents some XmlDocument code that is pretty easy to translate to other languages and platforms.

Comments (3)

Screen-cast: Exploring Margins in Open XML WordprocessingML Documents

I’ve recorded a short screen-cast that explores some approaches to setting margins in a word-processing document.  I show setting margins for cells, paragraphs, and sections.

Uses the Open XML SDK 2.0 Productivity Tool to explore various ways to set margins in an Open XML WordprocessingML document.


Querying for Fields in an Open XML WordprocessingML Document

I’ve written a blog post at that presents some code to query an Open XML WordprocessingML document for fields.  The code returns the field code for each field in the document.  Using this code, it becomes trivial to query a document for all hyperlinks in the document.  This will be the subject of my next post at


Deep Dive into Open XML WordprocessingML Fields and Hyperlinks – Part 2

I’ve posted the second video in this series on Open XML WordprocessingML fields and hyperlinks.  In this video, I show how the MarkupSimplifier application makes the markup for fields more understandable.  In addition, I explore the ways in which fields can be nested inside other fields.  This is a powerful technique, but the markup requires a bit of explanation.  Before watching this video, watch the first video of this deep-dive into Open XML WordprocessingML fields and hyperlinks.

Part 2 shows how MarkupSimplifier can be used to good effect. Also shows what the markup looks like when you nest fields within other fields.


Deep Dive into Open XML WordprocessingML Fields and Hyperlinks

Fields are one of the most powerful components of WordprocessingML markup.  You will see field markup in hyper-links, the TOC, dates, page references, calculated values, and much more.  I’ve been asked a few questions lately about fields in WordprocessingML markup.  Fields are perhaps one of the least understood aspects of WordprocessingML markup, but they are really not very hard.  I’ve embarked on a four part series to explain field markup, show some example code that makes it easier to work with fields, and then show some code that reliably retrieves all hyper-links in an Open XML WordprocessingML markup.  The following video is the first of this four part series:

Deep dive into Open XML WordprocessingML markup

Comments (3)

Ease your WordprocessingML Research using the Open XML Markup Simplifier Application

Sometimes when researching Open XML WordprocessingML markup, extraneous markup gets in the way of your research.  The extraneous markup makes it harder to see and understand the markup issues at hand.  The MarkupSimplifier class (which is part of the PowerTools for Open XML project) can help a lot, but as downloaded from CodePlex, it is only a class.  You need to write code to use the class, and if you want to use the markup simplifier as part of your research process, it is inconvenient.  I’ve written a small WinForm application that uses the MarkupSimplifier class, and makes the use of the simplifier class much more seamless in your research.

You can download the Markup Simplifier Application at  The code is attached to the blog post.

I’ve recorded a six minute video that shows the Markup Simplifier application in action:

This video shows how to build and run the Markup Simplifier application.


Change the Schema for Simple Free Doc Generation System

I’ve posted a short (3 minute) screen-cast that shows how easy it is to change the schema for my simple document generation system that uses XPath expressions in Open XML WordprocessingML content controls.  It was super-easy to do – I didn’t rehearse – just sat down and recorded the screen-cast in a single take.

This post is the 16th in a series of blog posts on generating Open XML documents. Here is the complete list: Generating Open XML WordprocessingML Documents Blog Post Series

Demonstrates changing the schema for this simple document generation system that you configure by writing XPath expressions in content controls.

Comments (2)

« Previous Page« Previous entries « Previous Page · Next Page » Next entries »Next Page »