Server-side document generation of Word 2007 files

I bet you thought this was going to be a post about the spiffy new Content Controls and all of the spiffy new scenarios they give us when we bind them to a custom XML file in the new docx file format. 

Well, nope, I’m not even going to mention that.  Instead, I’m going to post about another option that can help if you need to generate a document from XML data with repeating nodes – which is NOT one of the spiffy new scenarios that content controls give us 🙁

I know more than one person who was disappointed that a Word document moved from just a single XML file to a cab file that contains lots of different parts (docx) specifically because it means we can’t generate a doc from a single XSLT.  Well, guess what?  We can still save our Word 2007 docs as XML. You will get a serialized version of the entire package in a single XML file.  Check it out:

The results (sans PI):

“What’s the catch?” you ask.  You won’t have the packaging APIs to manage all of the part relationships for you.  This can turn in to a big pain in the butt if you are adding/modifying parts of the package as there is a lot of bookkeeping you just get with the APIs.  The other catch is that using an XSLT will probably be a more resource intensive process.

2 thoughts on “Server-side document generation of Word 2007 files

Leave a Reply

Your email address will not be published. Required fields are marked *