Monday, January 02, 2012

Using OpenXML SDK to generate Word documents via templates (and without Word being installed)

Application design and programming in .NET - Utility to generate Word documents from templates using Visual Studio 2010 and Open Xml 2.0 SDK

This utility generates Word documents from templates using Content controls. The utility will be enhanced later as per feedback and source code is available for download at It has been created in Visual Studio 2010 and uses Open Xml 2.0 SDK which can be downloaded from

The purpose of creating this utility was to use the Open Xml 2.0 SDK to generate Word documents based on predefined templates using minimum code changes. These documents can either be refreshable or non- refreshable. I’ll explain this difference later. Also there is no dependency that Word should be installed.

A few samples for generating Word 2010 documents have been provided. More samples can be added later as per feedback. The screenshots below display the sample template and the document generated out of this template using this utility.



In short, generate Word documents on servers, in automated processes, etc, without Word being installed. [Insert lame "Friends don't let Friends use the Word Automation on Servers" statement here]

No comments: