Export (0) Print
Expand All
1 out of 4 rated this helpful - Rate this topic

Getting Started Programming Document-Level Customizations for Word

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005

    -or-

    Visual Studio Team System

  • Microsoft Office 2003

If you are just getting started creating document-level customizations for Microsoft Office Word 2003 by using Microsoft Visual Studio 2005 Tools for the Microsoft Office System, here is what you need to know.

The Single Document Application Model

Each Word customization you create by using Visual Studio Tools for Office is based around a single document. To start using the customization, the end user opens the document or creates the document from a Word template. Events in the document, for example entering specific areas or clicking buttons and menu items, can call event-handling methods in the assembly. For more information, see Architecture of Visual Studio Tools for Office Solutions.

Using Host Controls

There are new controls available that enable you to program directly against bookmarks and XML nodes the same way you program against controls on Windows Forms. These objects, called host controls, are based on native Word objects, but they are extended with new events and data binding capability. They appear as first-class objects in the programming model and in IntelliSense, which makes it easier to refer to specific objects directly in your code without having to walk through the Word object model.

The Bookmark control is available on the Word Controls tab of the Toolbox in the Visual Studio designer, and you can also add bookmarks to a document the same way you do when you work with Word by itself. You add XMLNode controls by mapping an XML schema to your document; the host controls are created automatically for each mapped element. For more information, see Word Host Controls.

Using Data Binding

The Bookmark control is also in the list of controls that you can drag from the Data Sources window. Adding bookmarks in this way automatically binds them to the data source that you set up using the window. Without writing any code, you can display data from databases, Web services, and objects in your document. For more information, see Connecting to Data.

Next Steps

For a list of topics that walk you through some of the common tasks in Word automation, see Common Tasks in Office Programming.

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.