Skip to content

Latest commit

 

History

History
63 lines (50 loc) · 4.6 KB

automating-word-by-using-extended-objects.md

File metadata and controls

63 lines (50 loc) · 4.6 KB
title description ms.date ms.topic dev_langs helpviewer_keywords author ms.author manager ms.subservice
Automate Word by using extended objects
Learn how you can use host items and host controls in your solutions when you develop Word solutions in Visual Studio.
02/02/2017
conceptual
VB
CSharp
Word [Office development in Visual Studio], automating
extended objects [Office development in Visual Studio], Word
automation [Office development in Visual Studio], Word
host items [Office development in Visual Studio], Word
automating Word
controls [Office development in Visual Studio], Word host controls
host controls, Word
host controls [Office development in Visual Studio], Word
Word [Office development in Visual Studio], host controls
John-Hart
johnhart
mijacobs
office-development

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 xref:Microsoft.Office.Interop.Word.Document and xref: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.

[!INCLUDEappliesto_wdalldocapp]

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 xref:Microsoft.Office.Tools.Word.Document host item. The xref:Microsoft.Office.Tools.Word.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 xref:Microsoft.Office.Tools.Word.Document host item also provides most of the same members as the xref:Microsoft.Office.Interop.Word.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:

Related content