Automate 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 Document and 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.
Document host item
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 Document class, which is the corresponding class in the object model of Word.
For more information, see Document host item.
Word host controls
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: Create a template by using content controls
- Walkthrough: Bind content controls to custom XML parts
- Walkthrough: Create shortcut menus for bookmarks
- Word solutions
- Host items and host controls overview
- Programmatic limitations of host items and host controls
- Extend Word documents and Excel workbooks in VSTO Add-ins at run time