Using Content Controls to Repeat Form Fields in Microsoft Word 2007 and Word 2010

AID: 3656
  • Status: Published

9710 points

  • Bychapmanjw
  • TypeTutorial
  • Posted on2010-09-03 at 10:11:16
Awards
  • Community Pick
  • Experts Exchange Approved
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 (http://dbe.codeplex.com/).

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 (http://dbe.codeplex.com/).


2
In Word 2007/2010, enable the Developer ribbon tab if it is not already enabled.


a. For Word 2007:
1. Select the Office button
040910-2213-UsingConten1.gif
  • 1 KB
  • Select Office Button
Select Office Button

2. Select Word Options
3. Click Popular and then select “Show Developer tab in the Ribbon”


b. For Word 2010:
1. Select File > Options
040910-2213-UsingConten2.png
  • 18 KB
  • Select File Options
Select File Options

2. Select Customize Ribbon and ensure the Developer option is marked.
040910-2213-UsingConten3.png
  • 79 KB
  • Customize Ribbon
Customize Ribbon


3
On the Developer Tab, be sure to select Design Mode for adding and editing form fields
040910-2213-UsingConten4.png
  • 61 KB
  • Developer Toolbar
Developer Toolbar



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)


040910-2213-UsingConten6.png
  • 23 KB
  • Enter Properties
Enter Properties



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.
040910-2213-UsingConten7.png
  • 99 KB
  • Create Fields
Create Fields



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.
040910-2213-UsingConten8.png
  • 69 KB
  • Content Control Toolkit
Content Control Toolkit



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.
040910-2213-UsingConten10.png
  • 5 KB
  • Enter Company Tag
Enter Company Tag



"<tagname />" will simply add the tag and not add any default value in the XML.

"<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
040910-2213-UsingConten11.png
  • 6 KB
  • Add Other Tags
Add Other Tags



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
You should see the text entered repeated in the other linked fields.



By using this technique, you can create very robust form-driven documents.  

Original Article: http://www.johnchapman.name/using-content-controls-to-repeat-form-fields-in-microsoft-word-2007-and-word-2010/
    Asked On
    2010-09-03 at 10:11:16ID3656
    Tags

    content controls

    ,

    repeat form fields

    ,

    forms

    ,

    form fields

    ,

    word

    ,

    word 2007

    ,

    word 2010

    Topic

    Microsoft Word

    Views
    3849

    Comments

    Add your Comment

    Please Sign up or Log in to comment on this article.

    Join Experts Exchange Today

    Gain Access to all our Tech Resources

    Get personalized answers

    Ask unlimited questions

    Access Proven Solutions

    Search 3.2 million solutions

    Read In-Depth How-To Guides

    1000+ articles, demos, & tips

    Watch Step by Step Tutorials

    Learn direct from top tech pros

    And Much More!

    Your complete tech resource

    See Plans and Pricing

    30-day free trial. Register in 60 seconds.

    Loading Advertisement...

    Top MS Word Experts

    1. GrahamSkan

      296,430

      Guru

      2,000 points yesterday

      Profile
      Rank: Genius
    2. teylyn

      43,476

      2,400 points yesterday

      Profile
      Rank: Genius
    3. chris_bottomley

      42,500

      0 points yesterday

      Profile
      Rank: Genius
    4. EricFletcher

      32,732

      0 points yesterday

      Profile
      Rank: Sage
    5. dlmille

      31,800

      0 points yesterday

      Profile
      Rank: Genius
    6. thinkpads_user

      21,832

      0 points yesterday

      Profile
      Rank: Genius
    7. finalword

      18,868

      0 points yesterday

      Profile
      Rank: Guru
    8. l33tf0b

      17,269

      0 points yesterday

      Profile
      Rank: Wizard
    9. BillDL

      15,550

      0 points yesterday

      Profile
      Rank: Genius
    10. Flyster

      15,000

      0 points yesterday

      Profile
      Rank: Sage
    11. puppydogbuddy

      14,700

      0 points yesterday

      Profile
      Rank: Genius
    12. paulsauve

      13,968

      2,000 points yesterday

      Profile
      Rank: Sage
    13. matthewspatrick

      13,186

      10 points yesterday

      Profile
      Rank: Savant
    14. PandaPants

      13,000

      0 points yesterday

      Profile
      Rank: Master
    15. regmigrant

      12,500

      0 points yesterday

      Profile
      Rank: Guru
    16. KCTS

      11,953

      0 points yesterday

      Profile
      Rank: Genius
    17. Helen_Feddema

      11,826

      0 points yesterday

      Profile
      Rank: Genius
    18. aikimark

      11,500

      0 points yesterday

      Profile
      Rank: Genius
    19. CodeCruiser

      9,000

      0 points yesterday

      Profile
      Rank: Genius
    20. GasperK

      8,498

      0 points yesterday

      Profile
      Rank: Master
    21. RobSampson

      8,200

      0 points yesterday

      Profile
      Rank: Genius
    22. motnahp00

      8,136

      0 points yesterday

      Profile
      Rank: Sage
    23. TBone2K

      7,600

      0 points yesterday

      Profile
      Rank: Sage
    24. ogctech

      7,600

      0 points yesterday

      Profile
    25. Rartemass

      7,400

      0 points yesterday

      Profile
      Rank: Wizard

    Hall Of Fame