wordpress hit counter
Content controls demo: invoice creation - OpenXML Developer - Blog - OpenXML Developer
Goodbye and Hello

OpenXmlDeveloper.org is Shutting Down

There is a time for all good things to come to an end, and the time has come to shut down OpenXmlDeveloper.org.

Screen-casts and blog posts: Content on OpenXmlDeveloper.org will be moving to EricWhite.com.

Forums: We are moving the forums to EricWhite.com and StackOverflow.com. Please do not post in the forums on OpenXmlDeveloper.org. Instead, please post in the forums at EricWhite.com or at StackOverflow.com.

Please see this blog post for more information about my plans moving forward.  Cheers, Eric

Content controls demo: invoice creation

Content controls demo: invoice creation

Rate This
  • Comments 9

By Vijayeta Tilak of Sonata-Software Limited

The Article describes an application which demonstrates the use of content controls and custom XML to map data to each of these content controls in the word document.

This application uses System.IO.Packaging API (in .NET Framework 3.0) and is freely downloadable.

To make use of these features of the new Office 2007, the application generates sample invoices to a particular organization which holds details about all the Expenses and Contract work assigned.

In this example, each of the invoice documents is identified by a distinct invoice number, say to one particular organization. All the invoice numbers are listed out to the user, for him to select the information he wants to view about that invoice.

On selection of a number from the drop down box, the application displays all the information present for the selected invoice document.

The user can also view the sample of the document that would be generated, by clicking on the link provided.


The UI is as shown here:






When the button ‘Create Document’ is clicked, the application does the following processes

1.       Creates XML document from the database table which holds all the information regarding the invoice selected.

2.       The XML file is then added to the document package to be created.This XML file would serve as custom XML in the word document package to be generated.

3.       Generates content controls in the word document to be generated, depending on the data provided by the XML file generated from the database table.

4.       Map data from the custom XML file to each of the content controls, using XML Mapping.

Once the document ids created, it can be downloaded from the link provided.

The resulting document wolud be,



This is a basic application that only allows the user to view the data. It can be enhanced to upload a existing document and change the contents, and also generate multiple documents.


Attachment: demoContentControls.zip
Page 1 of 1 (9 items)