Helper Methods for Host Controls

You can programmatically add host controls to a Microsoft Office Word document and Microsoft Office Excel workbook at run time by using helper methods. The helper methods are in the Microsoft.Office.Tools.Excel.ControlCollection and Microsoft.Office.Tools.Word.ControlCollection classes.

For more information, see Adding Controls to Office Documents at Run Time.

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

The following table lists the helper methods that you can use to programmatically add host controls to Excel workbooks.

Helper method

Description

AddChart(Range, String)

Adds a Chart control to the specified range.

AddChart(Double, Double, Double, Double, String)

Adds a Chart control at the specified position, instead of in a range. The coordinates are represented in points.

AddListObject(Range, String)

Adds a ListObject control to the specified range.

AddListObject(ListObject)

Adds a ListObject control that is based on a native list object in the workbook.

AddNamedRange(Range, String)

Adds a NamedRange control to the specified range.

The following table lists the helper methods that you can use to programmatically add host controls to Word documents.

Helper Method

Definition

AddBookmark(Range, String)

Adds a Bookmark control at the specified range.

AddBuildingBlockGalleryContentControl(String)

Adds a BuildingBlockGalleryContentControl at the current selection in the document.

AddBuildingBlockGalleryContentControl(ContentControl, String)

Adds a BuildingBlockGalleryContentControl that is based on a native content control in the document.

AddBuildingBlockGalleryContentControl(Range, String)

Adds a BuildingBlockGalleryContentControl at the specified range.

AddComboBoxContentControl(String)

Adds a ComboBoxContentControl at the current selection in the document.

AddComboBoxContentControl(ContentControl, String)

Adds a ComboBoxContentControl that is based on a native content control in the document.

AddComboBoxContentControl(Range, String)

Adds a ComboBoxContentControl at the specified range.

AddContentControl(String, WdContentControlType)

Adds a ContentControl of the specified type at the current selection in the document.

AddContentControl(ContentControl, String)

Adds a ContentControl that is based on a native content control in the document.

AddContentControl(Range, String, WdContentControlType)

Adds a ContentControl of the specified type at the specified range.

AddDatePickerContentControl(String)

Adds a DatePickerContentControl at the current selection in the document.

AddDatePickerContentControl(ContentControl, String)

Adds a DatePickerContentControl that is based on a native content control in the document.

AddDatePickerContentControl(Range, String)

Adds a DatePickerContentControl at the specified range.

AddDropDownListContentControl(String)

Adds a DropDownListContentControl at the current selection in the document.

AddDropDownListContentControl(ContentControl, String)

Adds a DropDownListContentControl that is based on a native content control in the document.

AddDropDownListContentControl(Range, String)

Adds a DropDownListContentControl at the specified range.

AddGroupContentControl(String)

Adds a GroupContentControl at the current selection in the document.

AddGroupContentControl(ContentControl, String)

Adds a GroupContentControl that is based on a native content control in the document.

AddGroupContentControl(Range, String)

Adds a GroupContentControl at the specified range.

AddPictureContentControl(String)

Adds a PictureContentControl at the current selection in the document.

AddPictureContentControl(ContentControl, String)

Adds a PictureContentControl that is based on a native content control in the document.

AddPictureContentControl(Range, String)

Adds a PictureContentControl at the specified range.

AddPlainTextContentControl(String)

Adds a PlainTextContentControl at the current selection in the document.

AddPlainTextContentControl(ContentControl, String)

Adds a PlainTextContentControl that is based on a native content control in the document.

AddPlainTextContentControl(Range, String)

Adds a PlainTextContentControl at the specified range.

AddRichTextContentControl(String)

Adds a RichTextContentControl at the current selection in the document.

AddRichTextContentControl(ContentControl, String)

Adds a RichTextContentControl that is based on a native content control in the document.

AddRichTextContentControl(Range, String)

Adds a RichTextContentControl at the specified range.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft