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.

Print | posted on Friday, February 16, 2007 6:19 PM

Feedback

# re: Server-side document generation of Word 2007 files

Left by Robert te Kaat at 5/13/2009 6:20 AM
Gravatar I totally understand your frustration. I rebuild my xslt-based docgen-tool to support the new Word 2007-format, by tweaking the original xslt and have the Open XML SDK handle all the package-related stuff. You can find the result in my codeplex-project (open source): http://flexdoc.codeplex.com

Your comment:





 
Please add 7 and 1 and type the answer here:

Copyright © John Peltonen

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski