Generating Open XML WordprocessingML Documents

Update August 26, 2015: I have enhanced this document generation system, and published it as part of Open-Xml-PowerTools, which you can find at https://github.com/OfficeDev/Open-Xml-PowerTools. Going forward, I will be enhancing and maintaining that document generation system. Please feel free to clone / fork that repo, report issues on GitHub, and interact with me there.

This is a blog post series on parameterized Open XML WordprocessingML document generation. While it is easy enough to write an purpose-built application that generates WordprocessingML documents, too often, developers find themselves building new applications for similar but somewhat different scenarios. However, if we take the right approach, it is possible to build a simple document generation system that makes it far easier to address a wide variety of scenarios. I believe that a flexible document generation system can be written in a few hundred lines of code. This page lists the posts that are part of the series. I’ll be updating this page with new posts as I write them.

When I started this series, I initially started using a design where the document template designer writes C# code in content controls. That approach is interesting, and it was fun to write. However, I have determined that writing XPath expressions in content controls is a superior approach. I am going to let those twelve posts stand on their own, and start a new list of posts. I’ll maintain both lists on this page.

XPath-in-Content-Controls

Post Title Description 1 Generating Open XML WordprocessingML Documents using XPath Expressions in Content Controls In this post, I present the ideas around configuring the document template for mass document generation using XPath expressions in content controls. 2 Release of V2 of Doc Gen System: XPath in Content Controls Release of V2 of a simple document generation system. In this example, you configure the document generation process by creating a template document that contains content controls. You then enter XPath expressions in the content controls to configure how the document generator pulls data from a source XML file. 3 Review of XPath Semantics of LINQ to XML In this post, I discuss the semantics of the XPath extension methods. In addition, I provide a small example that demonstrates how the various XPath expressions in the template document are related to each other. 4 Change the Schema for Simple Free Doc Generation System Short (3-minute) screen-cast that shows changing the schema for the XPath-in-Content-Controls approach to document generation.

C#-in-Content-Controls