Partager via


ContentControl Interface

Definition

Represents a content control a document.

public interface class ContentControl : IDisposable, Microsoft::Office::Tools::Word::ContentControlBase, System::ComponentModel::IComponent, System::ComponentModel::ISupportInitialize, System::Windows::Forms::IBindableComponent
[System.Runtime.InteropServices.Guid("ee82979b-2814-48b1-95dd-4bfcc636a7ec")]
public interface ContentControl : IDisposable, Microsoft.Office.Tools.Word.ContentControlBase, System.ComponentModel.IComponent, System.ComponentModel.ISupportInitialize, System.Windows.Forms.IBindableComponent
[<System.Runtime.InteropServices.Guid("ee82979b-2814-48b1-95dd-4bfcc636a7ec")>]
type ContentControl = interface
    interface ContentControlBase
    interface IBindableComponent
    interface IComponent
    interface IDisposable
    interface ISupportInitialize
Public Interface ContentControl
Implements ContentControlBase, IBindableComponent, IComponent, IDisposable, ISupportInitialize
Attributes
Implements

Remarks

A ContentControl object is a mutable control that can represent any of the eight types of content controls that you can use in Microsoft Office Word. For example, if you create a ContentControl that initially has the functionality of a plain text control, you can change it at run time so that it behaves like a combo box. Other content controls cannot be used in this way. For example, a RichTextContentControl can only represent a rich text control. For more information about content controls, see Content Controls.

To create a ContentControl, use one of the AddContentControl methods. You cannot add a ContentControl to a document at design time.

When you create a ContentControl, you must specify the type of the content control that you want to create, or you can base the new control on an existing content control. After you create a ContentControl, you can change the type of content control that it represents by using the Type property.

Some ContentControl members will throw an exception if you use them while the control is set to a type of control that is not intended to use the member. For example, the DateCalendarType property will throw an exception if you try to use it on a ContentControl that does not represent a date picker.

Note

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.

Usage

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.

Properties

Application

Gets a Application that represents the current instance of Microsoft Office Word.

BuildingBlockCategory

Gets or sets the category of building blocks that are displayed in a ContentControl that represents a building block gallery.

BuildingBlockType

Gets or sets the type of the building blocks that are displayed in a ContentControl that represents a building block gallery.

Checked

Gets or sets a value that indicates whether a ContentControl that represents a check box control is checked or unchecked.

Container (Inherited from ContentControlBase)
ContainerComponent (Inherited from ContentControlBase)
Creator

Gets a 32-bit integer that indicates the application in which the ContentControl was created.

DateCalendarType

Gets or sets the type of calendar that is displayed in a ContentControl that represents a date picker.

DateDisplayFormat

Gets or sets a string that specifies the format of dates that are displayed in a ContentControl that represents a date picker.

DateDisplayLocale

Gets or sets the language format of the date that is displayed in a ContentControl that represents a date picker.

DateStorageFormat

Gets or sets the format in which dates are saved in a custom XML part by a ContentControl that represents a date picker.

DefaultDataSourceUpdateMode

Gets or sets the default DataSourceUpdateMode for the ContentControlBase.

(Inherited from ContentControlBase)
DefaultTextStyle

Gets the name of the character style that is used to format text in the ContentControl.

DropDownListEntries

Gets the collection of items that are displayed by a ContentControl that represents a drop-down list or a combo box.

ID

Gets a unique number that identifies the content control.

(Inherited from ContentControlBase)
InnerObject

Gets the underlying ContentControl object for the ContentControlBase.

(Inherited from ContentControlBase)
LockContentControl

Gets or sets a value that specifies whether the ContentControl can be deleted from the document.

LockContents

Gets or sets a value that specifies whether the contents of the ContentControl can be edited.

MultiLine

Gets or sets a value that specifies whether the ContentControl can contain line breaks.

Parent

Gets the parent of the ContentControl.

ParentContentControl

Gets the parent content control of a ContentControl that is nested in another content control.

PlaceholderText

Gets the text that is displayed in the ContentControl until the text is changed by a user action or some other operation.

Range

Gets a Range that represents the contents of the ContentControl.

ShowingPlaceholderText

Gets a value that specifies whether the ContentControl is currently displaying placeholder text.

Tag

Gets or sets a string that you want to associate with the ContentControl.

Temporary

Gets or sets a value that specifies whether the ContentControl is automatically deleted from the document when the control is edited.

Title

Gets or sets the title of the ContentControl.

Type

Gets or sets a value that specifies the type of content control that the ContentControl represents.

XMLMapping

Gets an XMLMapping that represents the binding between the ContentControl and an element in a custom XML part.

Methods

Copy()

Copies the ContentControl from the document to the Clipboard.

Cut()

Removes the ContentControl from the document and adds it to the Clipboard.

Delete(Boolean)

Deletes a dynamically created content control from the document and removes it from the ControlCollection in the document.

(Inherited from ContentControlBase)
SetCheckedSymbol(Int32, String)

Sets the symbol used to represent the checked state of a ContentControl that represents a check box control.

SetPlaceholderText(BuildingBlock, Range, String)

Displays text that is in a BuildingBlock, a Range, or a string as the placeholder text in the ContentControl.

SetUncheckedSymbol(Int32, String)

Sets the symbol used to represent the unchecked state of a ContentControl that represents a check box control

Ungroup()

Removes the group content control that contains the ContentControl from the document so that the region is no longer protected.

Events

Added

Occurs after the content control is added to the document.

(Inherited from ContentControlBase)
BindingContextChanged

Occurs when the value of the BindingContext property of the ContentControlBase changes.

(Inherited from ContentControlBase)
ContentUpdating

Occurs just before Microsoft Office Word updates the text in the content control, if the content control is bound to a custom XML part.

(Inherited from ContentControlBase)
Deleting

Occurs just before the content control is deleted from the document.

(Inherited from ContentControlBase)
Entering

Occurs when the user clicks in the content control, or when the cursor is moved into the content control programmatically.

(Inherited from ContentControlBase)
Exiting

Occurs when the user clicks outside the content control, or when the cursor is moved outside the content control programmatically.

(Inherited from ContentControlBase)
StoreUpdating

Occurs just before Microsoft Office Word updates data in a custom XML part that is bound to the content control (that is, after the text in the content control changes).

(Inherited from ContentControlBase)
Validated

Occurs when the content control has been successfully validated.

(Inherited from ContentControlBase)
Validating

Occurs when the contents of the content control are being validated.

(Inherited from ContentControlBase)

Applies to