How to: Change a Content Control from One Type to Another
Word Developer Reference |
The content controls that you can create in Microsoft Office Word 2007 documents are extremely flexible. In most cases, you can easily switch a content control from one type to another. For example, if you have a date content control, you can change it to be a text content control, or if you have a text content control, you can change it to be a rich-text content control. To do this, you use the Type property and set it to a WdContentControlType constant.
Note |
---|
Depending on the contents of a content control, you may not be able to change the content control type. For example, if you have a rich-text content control that contains formatted text, you may not be able to change the control to be a plain-text content control. In this case, Word raises a run-time error. |
The objects used in this sample are:
The following example inserts a new date content control that contains the current date and then changes it to be a text content control.
|
The following example inserts a drop-down list content control and then changes it to be a rich-text content control.
|