When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than manually entering the company name into every place it is needed. This helps greatly to ensure fewer errors and improves efficiency when users fill out the form.

In Word 2003 and prior this could be done by inserting a form field and then referencing it as a book mark. In that scenario, the designer of the form would add the field once and mark it to be bookmarked in the field properties. Then wherever the field would need to be repeated they could hit CTRL-F9 and then enter “{ REF fieldname }” to reference the field. This method still works in Word 2007 and 2010. However, it uses the “legacy” form controls and does not allow you to take advantage of the new controls, such as the date chooser. The legacy reference technique also only allows the user to fill in the information in one field; they cannot enter it into just any of the occurrences throughout the document and have it update the rest.

In Word 2007 and 2010, it is no longer possible to simply bookmark the form control and cross-reference it later in the document. However, since the Word 2007+ (.docx) format is now XML-based, the new Content Control features can be used to reference information in the XML structure. And even better, that XML structure is fully customizable in a rather easy manner.

To customize and word with the XML associated with these controls, there is a free application called the Word Content Control Toolkit. It can be downloaded from CodePlex.

The following steps are a quick tutorial on using this tool and creating a simple form that ties multiple fields together with the same value:

  1. Download and install the Word Content Control Toolkit from CodePlex.
  2. In Word 2007/2010, enable the Developer ribbon tab if it is not already enabled.
    1. For Word 2007:
      1. Select the Office button

      2. Select Word Options
      3. Click Popular and then select “Show Developer tab in the Ribbon”
    2. For Word 2010:
      1. Select File > Options

      2. Select Customize Ribbon and ensure the Developer option is marked.

  3. On the Developer Tab, be sure to select Design Mode for adding and editing form fields

  4. Insert a few form fields to create your simple form.
  5. For each field, edit the Properties to give a meaningful name (I usually also select “Content control cannot be deleted” to ensure the form stays intact).




  6. My simple form has the Company Name repeated twice. The end goal is to have the ability to edit either field and have it update the other.

  7. Save the document and close Microsoft Word
  8. Open the Word 2007 Content Control Toolkit and open the document you just saved in Microsoft Word.

  9. You will see the two fields listed on the left under Content Controls. On the right, select “Create a new Custom XML Part”.
  10. Make sure you are in the Edit View and not the Bind View

  11. Using basic XML, we will create the XML tag “<company />” where the Company name will be stored. You can add as many of these as you would like as well as add sample text if you wish.

    1. “<tagname />” will simply add the tag and not add any default value in the XML.
    2. “<tagname>Default Value Text Goes Here</tagname>” ¢€“ entering the default text inside the tag will set the default value if desired
  12. There is no set limit to the number of tags you can add

  13. After adding the desired tags, switch to the Bind View. You now need to associate these XML fields with the form fields. To do so, select the tag node in the bind view and drag it to the associated Content Control on the left.

  14. Save the document.
  15. Reopen the document in Microsoft Word and enter your information into the first linked field.

  16. It repeats the text as described and is good to go.

By using this technique, you can create very robust form-driven documents. If you have any questions or concerns, feel free to use the comments below.

Pin It on Pinterest

Share This
%d bloggers like this: