Graham Mayor

... helping to ease the lives of Microsoft Word users.

Many people access the material from this web site daily. Most just take what they want and run. That's OK, provided they are not selling on the material as their own; however if your productivity gains from the material you have used, a donation from the money you have saved would help to ensure the continued availability of this resource. Click the appropriate button above to access PayPal.

Insert Content Control Add-in for the PC version of Word 2010 and later.

Working on templates for a private client which required extensive use of content controls, I soon realised that Microsoft doesn't make it easy to insert, edit and especially map content controls. A while back, in conjunction with Greg Maxey I produced a simplified version of his Content Control tools which can be found at Bookmark and Variables on this site and the more complex version is on his site at Content Control Tools.

Thanks too to Greg for making some valuable suggestions for inclusion and change and especially for the validation process he has provided.

This earlier version however was not that helpful in cutting down the number of steps needed to insert a content control, and in fact used the Word dialogs; so I created a simple tool that would insert the Text and Date controls I was working with and that made the job much easier.

The add-in featured here is based on that simple tool and features a variety of additional processes to edit content controls, that I have either had hanging around without a home to go to, or have created while working on client documents.

When installed in the Word startup folder, the add-in places two buttons on both the 'Insert' tab and the 'Developer' tab. 'Developer', as this is the logical place for the controls, but 'Insert' because I was working with bookmarks as well as content controls when I developed the processes and 'Insert' is where the bookmark insertion tool is found.

Insert Content Control

The primary option is that of inserting content controls, and the add-in presents a simple dialog with the main choices displayed. (It does not prevent users accessing the controls later using the built-in content control dialog).

One function it provides, that Microsoft chose to make much more complicated than it needs to be for the type of use that most will need it for, is that of mapping controls.

Mapped controls may be repeated by simple cut and paste, and whatever you enter in one of the controls will be echoed in its duplicate. This is a very useful option that most users will not even be aware of, as Microsoft doesn't shout it from the rooftops - as it should, when it provides something that users might actually appreciate (more on mapped controls at the end of this page).

The dialog features a simple dropdown field from which the various types of control are selected. I deliberately avoided the Building Block and Group controls, and for those still using Word 2007, the 'Check Box' control is not an option (as it was introduced in Word 2010) and the 'Include Border' option is not available in Word 2007 and 2010 (as this was introduced in Word 2013).

The options that are available vary according to which type of control is selected.

Most of the functions of this add-in are not compatible with Word 2007.

Date Control

The date control has a pop-out section from where you may select various options. I have chosen only to concentrate on US and UK format dates and those listed in the dropdown are the same as those Microsoft provides.

If you are using the tool to insert a date into a document, rather than a template, there is an option to select a date, which employs a variation of Trevor Eyre's handy VBA date picker.

One very useful opportunity this provides is for inserting fixed dates in documents. Enter a date and check the 'Prevent Deletion' and 'Prevent Editing' options and your document will have a date that is not easily deleted or changed, without accessing the control's properties.

It is not normally recommended that a start date is included in a template or macro enabled document, so the date option is provided with a process that will instead insert a CreateDate field.

 

Combo and List Box Controls

The combo and list box options also include a pop out panel into which the list items can be entered.

Employing a different 'value' property from the 'display name' property

One of the things you can do with list and combo box entries is provide separate texts for the display name text and value. By default the display name text and value text are the same, and so it was with the earlier versions of the add-in, however prompted by a question made in a Word forum, I have included the ability to have separate texts for display and value.

This works by inserting a pipe character to separate the display name text from the value text. Everything to the left of the first pipe character is the display name text. Everything to the right of that character (and that may include other pipe characters if required) is the value text.

To that end I have included the tip text as shown below.

If you don't need separate values for the two texts, then simply enter the display text alone as described in the earlier part of the page.

The rest of the control insertion options are similar to the Plain Text control options, shown below

 

Edit Content Controls

This is a new option developed to use a similar interface to the Insert Control function, but with the ability to page through all the controls in a document and edit them, including changing from one type to another,

The dialog is similar to and works in the same way as the Insertion dialog featured above albeit with a few obvious differences. The most noticeable are the background colour and the two large buttons that apply the revised settings.

The other dialog functions are:

  • Use default Placeholder text'
    Changes the current placeholder text for the default value for the specific type of control. This is useful when a control is changed to a different type.
  • Auto Copy Title to Tag - similar in function to the Match Tag with Title option on the Insert Control dialog
  • Copy Title to Tab
    Copies whatever is in the Title text box to the Tag text box.
  • Copy Tag to Title
    The reverse of the previous option - copies the contents of the Tag text box to the Title text box.
  • Prohibit Duplicates
    As its name suggests, when checked does not allow Control titles to be duplicated. Duplicated control titles/tags can be something of a pain when you wish to extract data from a form using content controls.
  • Validation text
    The large font blue text below the check boxes indicates whether the control texts are valid.
  •  Apply Above Rules' Buttons
    This pair of buttons applies whatever values have been selected in the dialog and moves to the next or previous control as appropriate.
When moving through the controls using the 'Apply' buttons the code detects whether a control is mapped and disables the 'Map control' option.

The editor does not offer the option to remove the mapping. If you want to remove the mapping from the control use the 'Delete Content Control' option to delete the control and reinsert a control without the map option.

Delete Content Control

A simple function to delete the selected content control with the option to leave the value that it contained.

Add/Edit/Remove Content Control List Entries

The editor now also has the ability to separate the display name and value properties by using a pipe character to separate the two. Thus it is also now possible to add separate value properties to existing controls that don't have them.

Having inserted the control, you may want to sort the list, or you may have spelled a name incorrectly, or you may wish to remove a name from your list. Microsoft doesn't make this easy - but the second part of the add-in does.

This time there is an entirely different dialog, which will appear if the Word cursor is in a combo or list box content control.

You will notice that the list now includes the placeholder text, and when sorting you would want to preserve that at the top of the list, so the process provides that option

From this dialog you can sort in A-Z or Z-A text order by clicking 'Sort List'.

The Sort button has the option to undo the sort.

If you click the 'Rearrange List' radio button, Additional options are provided for shuffling the list items around, e.g. you may want to put the ladies names before those of the gentlemen. You can do that from here:

 

The list items above show the use of alternative values for the entries. If the value is the same as the entry, then you don't need to include the pipe character and the text that follows it. The placeholder item where present, does not have a separate value.

Apply Settings to All Controls

Sometimes it is useful to apply a range of settings to all the controls in a document The functions currently available are shown in the following dialog:

The check boxes and option buttons provide a number of settings which may be applied to all appropriate content controls in a document:

In all cases where there are pairs of check boxes, the buttons in the right column must be set to allow the setting from the left column.

Where properties are specific to particular types of control, they are only applied to that type of control.

  1. Prevent Editing: When applied content control contents may be not be edited. The normal setting for this control is 'off'.
  2. Prevent Deletion: When applied content controls may not be deleted. Where applied to content controls in text boxes, frames or tables, those containers may not be moved or deleted, without unchecking the option.
  3. Include Border: Word versions before Word 2013 did not have the ability to have different border types around controls, and this option is thus not provided for Word 2010. By default a content control will have a border, however content controls inserted using this add-in may optionally be inserted with hidden borders
  4. Convert plain text controls to rich text controls and
  5. Convert rich text controls to plain text controls are mutually exclusive so are selected with option buttons, only one of which may be selected.
  6. Working in conjunction with 4 & 5 above, plain text controls may optionally include the setting to allow multiple lines of text in a control.
  7. 'Fix tags and titles': When applied, any content controls that have a tag, but no title or have a title but no tag, are updated to ensure that both title and tag are the same. Where there is neither title nor tag, the control title and tag is unchanged. To address this and check the settings in all the controls, you may use the 'Edit Control(s)' option from the add-in's ribbon menu.

  8. With the exception of 4 & 5, as many or as few of the selections may be applied at the same time, but they are only applied when the associated 'Enable setting' check box is checked.
    -----------------------------------------------------------------
  9. Add or Remove Editors: 'Editors' are used primarily when creating protected forms in which only the content controls may be edited, in much the same way as legacy form fields may be protected for filling in forms.

    When editors are used to create such a form, the content controls are marked as areas to be edited, when used in conjunction with 'No Changes, Read Only' as the document protection method.

    To protect the form (with or without a password) check the 'Lock Form' option which appears when the option to 'Add Editors' is selected. Editors are only added once so this option can be used to lock a form to which editors have already been applied.

    To unlock a protected form, select the option to 'Remove Editors' and check the 'Unlock Form' option which then becomes available. If the editors are not present this option will simply remove the protection. If a password has been applied, you will need to know that password, and enter it at the prompt, in order to use this option to unprotect the form.

  10. Protection may also be added or removed from the form using Word's protection options from the Developer tab of the ribbon.
    -----------------------------------------------------------------
  11. 'Delete all content controls' is a destructive option, unconnected with the other setting options, which consequently are disabled when this option is applied.

The option, as its label suggests, deletes all the content controls in the current document, leaving the contents of those controls. The aim is to produce a finalized copy of the document, where no further editing to the control contents is possible e.g. certain legal documents may not be acceptable when they contain content controls.

Once applied and the document is saved, the controls are not recoverable. If applied in error, despite the cautionary warning that is displayed when used, close the document without saving and re-open it again.

In order to ensure that the document may be recovered with its edits intact, it is advisable to save the document BEFORE deleting the controls."

Apply Settings to All List or Combo Box Controls

Similar in concept to the previous item, I was inspired to add this process by a forum post which concerned a form where hundreds of combo box controls had been inserted, where list boxes would have been more appropriate, and the lists themselves (common to all the controls) would have benefitted from some minor editing. Editing them one by one even using the facilities provided by this add-in would have taken forever, so I created this process to complete those tasks in a single operation.

The list and editors features are similar to those detailed in previous processes above, so I see no need to repeat them here. There is also context sensitive help available.

 

Add Unique Titles to Untitled Controls

It is advisable to title and tag content controls that are used for anything more adventurous than place markers. This process checks through all the controls in a document and gives a unique title to any that are both untitled and untagged, with the name based on the control type.

Controls that have tags can be titled using the 'Fix Tags and Titles' option in the previous menu item'

Convert Form Fields to Content Controls

This is a updated version of a function used in my extract data from forms add-in, and does what the title suggests. It converts legacy form fields (for which you will need the password, if password protected for forms) to content controls. This is just an aid to converting older legacy forms to use content controls, which have distinct advantages when it comes to extracting and logging data.

Reset

Last, and definitely least, is an option to remove the pieces of data used by the add-in that are stored in the registry.

Mapped Controls

As mentioned earlier, the add-in provides an option to map add-in controls to the XML code of the document. The most common use of that is to enable content controls to be copied and pasted to provide duplicated entries elsewhere in a document. You can copy and paste e.g. a field containing a date or a name and that name can be reproduced elsewhere in the document by entering a value in any one of the duplicates:

 

 

   Click here to download the add-in

 

 

 

Insert Content Controls

Although content controls have been around for some considerable time, and my good friend Greg Maxey has been singing their praises and working with them, I am something of a late convert to their charms.

However that doesn't mean I have unbridled enthusiasm for the rather poor user interface that Microsoft offers by default.

The add-in featured here aims to improve that and adds a variety of tools to aid with editing controls to get the best from them.