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 VSTO add-in projects for Word. For more information, see Features Available by Office Application and Project Type.
Host items and host controls are available in both VSTO 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 VSTO Add-in 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:
How to: Add Content Controls to Word Documents
How to: Add Bookmark Controls to Word Documents
How to: Add XMLNode Controls to Word Documents
How to: Add XMLNodes Controls to Word Documents
How to: Resize Bookmark Controls
Walkthrough: Creating a Template By Using Content Controls
Walkthrough: Binding Content Controls to Custom XML Parts
Walkthrough: Creating Shortcut Menus for Bookmarks
Host Items and Host Controls Overview
Programmatic Limitations of Host Items and Host Controls
Extending Word Documents and Excel Workbooks in VSTO Add-ins at Run Time