Custom XML in a Word Document RRS feed

  • Question

  • Let's assume I have a custom XML ready to be inserted and "consumed" by a word document. This custom XML represents an invoice containing a header and some line items. What is the best approach to fill this data into a word document?


    I have tried this with the technologies available before the SDK for Open XML and I figured that it is quite easy to get the header data linked within the document, but I could not figure out an easy way to "make Word loop" through the line items and build, eg. a table for them...


    1. Is it also that easy to connect the word document with the header information?


    2. Is there an easy way to link the line items to the word document?


    Thankx, Cheers Harry

    Tuesday, June 5, 2007 8:32 AM

All replies

  • Hi Harry,


    While you can use Custom XML markup or Content Controls, both models still require you to create the WordprocessingML markup yourself. Word does not loop your data to make a table out of it. This only works in the other direction, when extracting data from a document.

    Hope it helps,



    Tuesday, June 5, 2007 9:22 AM
  • Hi there

    Do you know of an example bit of WordprocessingML that will do this looping of the data in to a table from the custom Xml file?

    Thanks for any help.

    Friday, June 15, 2007 4:11 PM
  • I'll see this as a todo item for my blog:

    Try it next week, and I'll have the sample for you.


    Wednesday, June 27, 2007 6:49 PM