ContentControl interface

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.

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

[GuidAttribute("EE95AFE3-3026-4172-B078-0E79DAB5CC3D")]
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.

Property/Method

Applies To

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)

Show:
© 2014 Microsoft