An individual content control. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as dates, lists, or paragraphs of formatted text. The ContentControl object is a member of the ContentControls collection.
public interface class ContentControl
[System.Runtime.InteropServices.Guid("EE95AFE3-3026-4172-B078-0E79DAB5CC3D")] public interface ContentControl
Public Interface ContentControl
Use the Add(WdContentControlType, Object) method of the ContentControls collection to create a content control. Use the
Type parameter of the Add method to specify the type of content control to create.
Use the Type property to change the content control to a different type of content control. For example, perhaps you want to change from a date control to a text control. However, you may not be able to change all content controls to another type; some may not allow changing their type. In addition, depending on the contents of a content control, you may not be able to change the type. For example, if the content control that you want to change to does not allow the type of content that is in the existing content control, attempting to change the type is not allowed and generates a run-time error.
Use the SetPlaceholderText(BuildingBlock, Range, String) method to change the placeholder text from the default string to something more appropriate for the control. Use the Title property to specify the title text for the control. This displays above the control when the cursor is positioned inside the control or the mouse pointer is positioned over the control.
Depending on the type of content control that you have, you may not be able to use all the properties and methods of the ContentControl object.
Not all content control properties apply to all the different types of content controls. The following table lists which properties apply to which types of content controls.
|BuildingBlockCategory property||BuildingBlock Gallery content controls (wdContentControlBuildingBlockGallery)|
|BuildingBlockType property||BuildingBlock Gallery content controls (wdContentControlBuildingBlockGallery)|
|DateDisplayFormat property||Date content controls (wdContentControlDate)|
|DateDisplayLocale property||Date content controls (wdContentControlDate)|
|DateStorageFormat property||Date content controls (wdContentControlDate)|
|DropdownListEntries property||Combo box and drop-down list content controls (wdContentControlComboBox and wdContentControlDropdownList)|
|MultiLine property||Plain text content controls (wdContentControlText)|
|Ungroup() method||Group content controls (wdContentControlGroup)|
|AllowInsertDeleteSection AllowInsertDeleteSection AllowInsertDeleteSection||
Gets or sets whether users can add or remove sections from the specified repeating section content control by using the user interface.
|Appearance Appearance Appearance||
Returns or sets the appearance of the content control. Read/write WdContentControlAppearance
|Application Application Application||
Returns an _Application object that represents the Microsoft Word application.
|BuildingBlockCategory BuildingBlockCategory BuildingBlockCategory||
Returns or sets the category for a building block content control. Read/write.
|BuildingBlockType BuildingBlockType BuildingBlockType||
Returns or sets the type of building block for a building block content control. Read/write.
|Checked Checked Checked||
Gets or sets the current state (checked/unchecked) for a check box.
|Color Color Color||
Returns or sets the color of the content control. Read/write WdColor.
|Creator Creator Creator||
Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only.
|DateCalendarType DateCalendarType DateCalendarType||
Returns or sets the calendar type for a calendar content control. Read/write.
|DateDisplayFormat DateDisplayFormat DateDisplayFormat||
Returns or sets the format in which dates are displayed. Read/write.
|DateDisplayLocale DateDisplayLocale DateDisplayLocale||
Returns a the language format for the date displayed in a date content control. Read/write.
|DateStorageFormat DateStorageFormat DateStorageFormat||
Returns or sets the format for storage and retrieval of dates when a date content control is bound to the XML data store of the active document. Read/write.
|DefaultTextStyle DefaultTextStyle DefaultTextStyle||
Returns or sets the name of the character style to use to format text in a text content control. Read/write.
|DropdownListEntries DropdownListEntries DropdownListEntries||
Returns the items in a drop-down list content control or in a combo box content control. Read-only.
|ID ID ID||
Returns the identification for a content control. Read-only.
|Level Level Level||
Returns the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline. Read-only WdContentControlLevel.
|LockContentControl LockContentControl LockContentControl||
Returns or sets a Boolean that represents whether the user can delete a content control from the active document. Read/write.
|LockContents LockContents LockContents||
Returns or sets a Boolean that represents whether the user can edit the contents of a content control. Read/write.
|MultiLine MultiLine MultiLine||
Returns a Boolean that represents whether a text content control allows multiple lines of text. Read/write.
|Parent Parent Parent||
Returns an that represents the parent object of the specified ContentControl object.
|ParentContentControl ParentContentControl ParentContentControl||
Returns the parent content control for a content control that is nested inside a rich-text control or group control. Read-only.
|PlaceholderText PlaceholderText PlaceholderText||
Returns a BuildingBlock object that represents the placeholder text for a content control. Read-only.
|Range Range Range||
Returns a Range that represents the contents of the content control in the active document. Read-only.
|RepeatingSectionItems RepeatingSectionItems RepeatingSectionItems||
Returns the collection of repeating section items in the specified repeating section content control. Read-only.
|RepeatingSectionItemTitle RepeatingSectionItemTitle RepeatingSectionItemTitle||
Returns or sets the name of the repeating section items used in the context menu associated with the specified repeating section content control. Read/write.
|ShowingPlaceholderText ShowingPlaceholderText ShowingPlaceholderText||
Returns a Boolean that indicates whether the placeholder text for the content control is displayed. Read-only.
|Tag Tag Tag||
Returns or sets a value to identify a content control. Read/write.
|Temporary Temporary Temporary||
Returns or sets a Boolean that represents whether to remove a content control from the active document when the user edits the contents of the control. Read/write.
|Title Title Title||
Returns or sets the title for a content control. Read/write.
|Type Type Type||
Returns or sets the type for a content control. Read/write.
|XMLMapping XMLMapping XMLMapping||
Returns the mapping of a content control to XML data in the data store of a document. Read-only.
|Copy() Copy() Copy()||
Copies the content control from the active document to the Clipboard.
|Cut() Cut() Cut()||
Removes the content control from the active document and moves the content control to the Clipboard.
|Delete(Boolean) Delete(Boolean) Delete(Boolean)||
Deletes the specified content control and the contents of the content control.
|SetCheckedSymbol(Int32, String) SetCheckedSymbol(Int32, String) SetCheckedSymbol(Int32, String)||
Sets the symbol used to represent the checked state of a check box content control.
|SetPlaceholderText(BuildingBlock, Range, String) SetPlaceholderText(BuildingBlock, Range, String) SetPlaceholderText(BuildingBlock, Range, String)||
Sets the placeholder text that displays in the content control until a user enters their own text.
|SetUncheckedSymbol(Int32, String) SetUncheckedSymbol(Int32, String) SetUncheckedSymbol(Int32, String)||
Sets the symbol used to represent the unchecked state of a check box content control.
|Ungroup() Ungroup() Ungroup()||
Removes a group content control from a document so that its child content controls are no longer nested and can be freely edited.