PowerTools Script that Generates a Table in an Open XML Document


Sometimes you want to generate a wordprocessing document that contains a table.  I've created an XML file that contains customers and orders, and a PowerShell script that uses the PowerTools for Open XML that generates a set of documents, each containing a table:

This blog is inactive.
New blog: EricWhite.com/blog

Blog TOC

The script and the source XML file are attached.

See Automated Processing of Open XML Documents using PowerShell for more information on the PowerTools for Open XML

GenerateCustomersOrders.zip

Comments (5)
  1. I often recommend peaple to keep an eye on CodePlex, these articles might tell you why : PowerTools Script

  2. Doug Mahugh says:

    Here are some interesting blog posts from the last week, as well as a few items I had missed while I

  3. Peter says:

    Hi Eric,

    Adding a table from Xml data or a database seems a pretty regular requirement. Am wondering if it's possible to add functionality to the PowerTools which would make it easier?

    Either just mapping rectangular Xml data to a table or using repeating content controls?

    Best regards,

    Peter

  4. Hi Peter,

    You are right – there should be a far easier way to put together all sorts of content in a DOCX.  I have in mind a project with a small API that enables you to create all sorts of content and assemble it together into a DOCX.

    However, I have to do one thing at a time, and right now my hot project is completing the high-fidelity transform of DOCX to HTML.

    openxmldeveloper.org/…/transform-docx-to-html-css-with-high-fidelity-using-powertools-for-open-xml.aspx

    But you are absolutely right, what you suggest is really needed.

    -Eric

  5. Catherine says:

    Is there a newer version of this script?  It is only creating the files with Tai Yee an nothing else.

Comments are closed.

Skip to main content