For questions involving working with Microsoft Word ContentControl objects in the Word object model, VSTO extended objects, Word Open XML file format or the Office JS APIs.
Word content controls were introduced in Word 2007 as an alternative / replacement for bookmarks and form fields. The original content control types:
- Plain text
- Rich text
- Date selector
- Building Block Gallery
- Picture box
- Drop-down list
- ComboBox
- Group
Word 2010 added the content control type
- Checkbox
Word 2013 added the content control type
- Repeating section
There are a number of events available for content controls. These are at the document-level:
- ContentControlAfterAdd
- ContentControlBeforeContentUpdate
- ContentControlBeforeDelete
- ContentControlBeforeStoreUpdate
- ContentControlOnEnter
- ContentControlOnExit
Content controls can be mapped to nodes in a Custom XML Part within the document. The content is then synced between node and content control (they have the same content).
In contrast to form fields or bookmarks, multiple Word content controls can have the same name (Title
). They also have the Tag
and Id
properties. Only the Id
, which is unique and assigned by the Word application to the content control, can be used as an index value to identify a specific content control.
To pick up content controls by their Title
or Tag
the SelectContentControlByTitle
/ SelectContentControlByTag
methods must be used. These return a Collection
. Title
and Tag
are case-sensitive.
Form field protection also applies to content controls: when the document is protected as a form content controls can be available for editing.