Content Controls

Content controls are editable regions within a document
content controls are defined regions in a document that can be used to contain specific content. For example document properties are mapped directly to content controls
You can bind content controls to database fields, .NET managed objects, xml elements or other data sources
In document-level projects you can add content controls at design time or at run time
In application-level projects you can add content controls to any document at run time
Content Controls are the editable regions of Building Blocks and there are a number of different types.
You can only use these in documents that are saved in the Open XMl file format
Content controls can be inserted into a document to provide more structure and more control.
These are editable regions in a document that can contain specific types of content
These are sometimes referred to as "Custom XML"

What can they be used for

They have a variety of uses:
Input Forms - Defining a labelled region in a template that can be easily updated and read
Protected Sections - Restrict or prevent the changing of information in a particular area of the document or template
Data Binding - Map data directly to a custom xml part

When content controls are added to a document, it is identified by a border, a title and optional temporary text
The border and title of the content control does not appear in printed versions of the document

Developer Tab

The controls can be found on the Developer tab
This tab is not displayed by default but can be displayed from (Options > Popular tab, "Show Developer tab in the Ribbon)
SS - Developer tab

Different Types

LockContentControl - corresponds to contents cannot be deleted
LockContents - corresponds to contents cannot be edited

Custom XML

XML is stored as flat OpenXML markup converted into a string
This allows it to be stored as text node in a custom xml part
This mapping has the limitation of only being able to map to leaf nodes or attributes

Design Mode

when is design mode small tags will be displayed around any content controls


The tag property can be used to identify the content controls programmatically

ContentControl Object

All eight content control types are represented by one object. The ContentControl object.

Word cannot turn off design mode because placeholder text in a content control contains invalid items

rich text box control must contain some text or a space

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopNext