ContentControl Class (2007 System)

Represents a content control a document.

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

Syntax

'Declaration
<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")> _
Public NotInheritable Class ContentControl _
    Inherits ContentControlBase _
    Implements ISupportInitializeControl, ISupportInitialize
'Usage
Dim instance As ContentControl
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")]
public sealed class ContentControl : ContentControlBase, 
    ISupportInitializeControl, ISupportInitialize
[PermissionSetAttribute(SecurityAction::Demand, Name = L"FullTrust")]
public ref class ContentControl sealed : public ContentControlBase, 
    ISupportInitializeControl, ISupportInitialize
public final class ContentControl extends ContentControlBase implements ISupportInitializeControl, ISupportInitialize

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 control classes in Visual Studio Tools for Office cannot be used in this way. For example, a RichTextContentControl object 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.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Tools.Office.RemoteComponent
    Microsoft.VisualStudio.Tools.Office.RemoteBindableComponent
      Microsoft.Office.Tools.Word.ContentControlBase
        Microsoft.Office.Tools.Word.ContentControl

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ContentControl Members

Microsoft.Office.Tools.Word Namespace

Other Resources

Content Controls

How to: Add Content Controls to Word Documents

How to: Protect Parts of Documents by Using Content Controls