ControlCollection Interface

 

Represents a collection of managed controls on a Word document that has been customized by using the Office development tools in Visual Studio.

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

[GuidAttribute("E1180F09-B903-4D03-8D30-2845219AEE2C")]
public interface ControlCollection : IEnumerable

NameDescription
System_CAPS_pubpropertyCapacity

Gets or sets the number of controls that the ControlCollection can contain.

System_CAPS_pubpropertyCount

Gets the number of controls in the ControlCollection.

System_CAPS_pubpropertyItem[Int32]

Gets the control at the specified index.

System_CAPS_pubpropertyItem[Object]

Gets the specified control.

System_CAPS_pubpropertyItem[String]

Gets the control with the specified name.

NameDescription
System_CAPS_pubmethodAddBookmark(Bookmark, String)

Adds a new Microsoft.Office.Tools.Word.Bookmark control to the document at the location of the existing Microsoft.Office.Interop.Word.Bookmark specified.

System_CAPS_pubmethodAddBookmark(Range, String)

Adds a new Bookmark control to the document at the specified range.

System_CAPS_pubmethodAddBuildingBlockGalleryContentControl(ContentControl, String)

Adds a new BuildingBlockGalleryContentControl to the collection. The new control is based on a native content control that is already in the document.

System_CAPS_pubmethodAddBuildingBlockGalleryContentControl(Range, String)

Adds a new BuildingBlockGalleryContentControl at the specified range in the document.

System_CAPS_pubmethodAddBuildingBlockGalleryContentControl(String)

Adds a new BuildingBlockGalleryContentControl at the current selection in the document.

System_CAPS_pubmethodAddComboBoxContentControl(ContentControl, String)

Adds a new ComboBoxContentControl to the collection. The new control is based on a native content control that is already in the document.

System_CAPS_pubmethodAddComboBoxContentControl(Range, String)

Adds a new ComboBoxContentControl at the specified range in the document.

System_CAPS_pubmethodAddComboBoxContentControl(String)

Adds a new ComboBoxContentControl at the current selection in the document.

System_CAPS_pubmethodAddContentControl(ContentControl, String)

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

System_CAPS_pubmethodAddContentControl(Range, String, WdContentControlType)

Adds a new ContentControl of the specified type at the specified range in the document.

System_CAPS_pubmethodAddContentControl(String, WdContentControlType)

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

System_CAPS_pubmethodAddControl(Control, Range, Single, Single, String)

Adds the specified control to the ControlCollection at the specified range, with the specified size.

System_CAPS_pubmethodAddControl(Control, Single, Single, Single, Single, String)

Adds the specified control to the ControlCollection at the specified location, with the specified size.

System_CAPS_pubmethodAddDatePickerContentControl(ContentControl, String)

Adds a new DatePickerContentControl to the collection. The new control is based on a native content control that is already in the document.

System_CAPS_pubmethodAddDatePickerContentControl(Range, String)

Adds a new DatePickerContentControl at the specified range in the document.

System_CAPS_pubmethodAddDatePickerContentControl(String)

Adds a new DatePickerContentControl at the current selection in the document.

System_CAPS_pubmethodAddDropDownListContentControl(ContentControl, String)

Adds a new DropDownListContentControl to the collection. The new control is based on a native content control that is already in the document.

System_CAPS_pubmethodAddDropDownListContentControl(Range, String)

Adds a new DropDownListContentControl at the specified range in the document.

System_CAPS_pubmethodAddDropDownListContentControl(String)

Adds a new DropDownListContentControl at the current selection in the document.

System_CAPS_pubmethodAddGroupContentControl(ContentControl, String)

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

System_CAPS_pubmethodAddGroupContentControl(Range, String)

Adds a new GroupContentControl at the specified range in the document.

System_CAPS_pubmethodAddGroupContentControl(String)

Adds a new GroupContentControl at the current selection in the document.

System_CAPS_pubmethodAddPictureContentControl(ContentControl, String)

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

System_CAPS_pubmethodAddPictureContentControl(Range, String)

Adds a new PictureContentControl at the specified range in the document.

System_CAPS_pubmethodAddPictureContentControl(String)

Adds a new PictureContentControl at the current selection in the document.

System_CAPS_pubmethodAddPlainTextContentControl(ContentControl, String)

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

System_CAPS_pubmethodAddPlainTextContentControl(Range, String)

Adds a new PlainTextContentControl at the specified range in the document.

System_CAPS_pubmethodAddPlainTextContentControl(String)

Adds a new PlainTextContentControl at the current selection in the document.

System_CAPS_pubmethodAddRichTextContentControl(ContentControl, String)

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

System_CAPS_pubmethodAddRichTextContentControl(Range, String)

Adds a new RichTextContentControl at the specified range in the document.

System_CAPS_pubmethodAddRichTextContentControl(String)

Adds a new RichTextContentControl at the current selection in the document.

System_CAPS_pubmethodContains(Object)

Determines whether the specified control is a member of the ControlCollection instance.

System_CAPS_pubmethodContains(String)

Determines whether a control with the specified name is a member of the ControlCollection instance.

System_CAPS_pubmethodGetEnumerator()

(Inherited from IEnumerable.)

System_CAPS_pubmethodGetInlineShapeForControl(Control)

Gets the underlying InlineShape for the specified control.

System_CAPS_pubmethodGetShapeForControl(Control)

Gets the underlying Shape for the specified control.

System_CAPS_pubmethodIndexOf(Object)

Searches for the specified control and returns the zero-based index of the first occurrence in the ControlCollection instance.

System_CAPS_pubmethodIndexOf(String)

Searches for the first occurrence of a control with the specified name in the ControlCollection instance.

System_CAPS_pubmethodRemove(Object)

Removes the specified control from the ControlCollection instance.

System_CAPS_pubmethodRemove(String)

Removes the specified control from the ControlCollection instance.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the control at the specified index in the ControlCollection instance.

Use the ControlCollection methods and properties to manage controls on a Word document. For more information, see Adding Controls to Office Documents at Run Time.

To get an ControlCollection object in a document-level project, use the Controls property of the ThisDocument class in your project. To get an ControlCollection object in an application-level project, use the Controls property of a Document host item that you create programmatically at run time. For more information, see Extending Word Documents and Excel Workbooks in VSTO Add-ins at Run Time.

The following table shows how to use ControlCollection members to perform some common tasks related to controls on documents.

Task

Action

Add a control to the document.

Use one of the AddControlName methods. For example, to add a content control, use the AddContentControl method.

Remove a control from the document.

Use the Remove method.

Determine whether a control is in the collection.

Pass the control or its name to the Contains method.

Get the index of a control in the collection.

Pass the control or its name to the IndexOf method.

Get a control from the collection.

Pass the index or name of the control to the Item property.

System_CAPS_noteNote

This interface is implemented by the Visual Studio Tools for Office runtime. It is not intended to be implemented in your code. For more information, see Visual Studio Tools for Office Runtime Overview.

This documentation describes the version of this type that is used in Office projects that target the .NET Framework 4 or later. In projects that target the .NET Framework 3.5, this type might have different members and the code examples provided for this type might not work. For documentation about this type in projects that target the .NET Framework 3.5, see the following reference section in the Visual Studio 2008 documentation: http://go.microsoft.com/fwlink/?LinkId=160658.

Return to top
Show: