Export (0) Print
Expand All

Automating Word by Using Extended Objects

When you develop Word solutions in Visual Studio, you can use host items and host controls in your solutions. These are objects that extend certain commonly used objects in the Word object model (that is, the object model that is exposed by the primary interop assembly for Word), such as the Microsoft.Office.Interop.Word.Document and Microsoft.Office.Interop.Word.ContentControl objects. The extended objects behave like the Word objects they are based on, but they add additional events and data binding capabilities to the objects.

Applies to: The information in this topic applies to document-level projects and application-level projects for Word 2013 and Word 2010. For more information, see Features Available by Office Application and Project Type.

Host items and host controls are available in both application-level add-ins and document-level customizations, although the context in which these can be used is different for each type of solution. For more information, see Host Items and Host Controls Overview.

Word projects give you access to the Document host item. The Document host item acts as a container for other controls, including host controls and Windows Forms controls, and it maintains information about the controls on its surface. The Document host item also provides most of the same members as the Microsoft.Office.Interop.Word.Document class, which is the corresponding class in the object model of Word.

For more information, see Document Host Item.

There are several host controls for Word that help you create, organize, and automate documents. Most of their functionality involves importing, presenting, and protecting data. These host controls provide events and data-binding capabilities that their counterparts in the native Word object model do not have.

In document-level projects, you can add any host control to your document at design time, or you can add content controls and bookmark controls at run time. In application-level projects, you can add content controls and bookmark controls to any open document at run time.

For more information about the host controls you can use in Word projects, see the following topics:

Show:
© 2014 Microsoft