MSDN Archive Home
Help and FAQs
Sample code for VSTO tutorial: Generating Invoices from a Word Template
All Resource Updates
Change History (all pages)
This download provides the complete project files and source code for a sample invoice-creation tool implemented by using VSTO in Visual Studio 2008.
This sample provides an implementation of a specific business scenario involving Word. In this scenario, an employee of the fictitious Northwind company uses a VSTO-customized Word template to create copies of sales invoices for customers that have placed orders with the company.
The employee uses data-bound controls on the Document Actions task pane (also called the actions pane) to choose the company and the order details to add to a table in the document. Only a subset of the order details are added to the table; the full order details are added to custom XML parts that are embedded in the document. To control the text in the document, the template uses data-bound content controls. The customer that the document is addressed to and the table that contains the order details are enclosed in read-only content controls, and can be modified only by using controls on the task pane.
After the employee is finished with the document, they can click a button on the task pane to remove the VSTO customization from the document. This enables other customers to open the document without having to install the VSTO customization.
This sample illustrates the following tasks:
• Creating a Word template project for Word 2007, and adding text and data-bound content controls to the template that is hosted in the Visual Studio designer.
• Adding an actions pane to the template, and adding data-bound controls to the task pane.
• Using the object model of Word to add rows to a table in the document, and to add custom XML parts to the document.
• Removing the VSTO customization from the document after the employee is finished with it.
This sample requires Word 2007 and Visual Studio 2008.
May 5 2010 at 8:43 PM
, version 9
Sign in to add a comment
Project Files and Sour...
Mon Sep 8 2008 at 7:00 AM
More Tags ...
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Manage Your Profile
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.