Word userforms based on customXML

Create smarter custom Word dialogs using customXML and Content Controls

Summary

When deploying templates, often dialog forms (popup windows) are needed to perform complex data entry. In the old days the information entered in these userforms were stored in bookmarks. Now there is customXML: a structured, standard way to store information supported by Content Controls.

Goal

Showing developers how customXML can help to store and retrieve data for self made input forms.

Audience

Expert Word developers making custom dialog screens

Prerequisites

Before starting this tutorial, make sure you understand the concepts of customXML and content controls. Please see the sidebar for reference to this tutorial.

Required knowledge

The developer needs in-depth knowledge of

  • XML
  • XPath 
  • Visual Basic for Application macros in Word
  • Word Userforms

The XPath knowledge is applied to easily get information from the custom XML part.

Required tools

  • Word 2007 or 2010
  • XML Authoring tool (Varying from Notepad, Notepad++, XML Explorer or Altova XML Spy)

 

 

Tutorial lessons

This tutorial exists of a number of lessons which must be followed in order to reach the desired effect. Please review each step by clicking on the title

0 - Overview

In this lesson I will give an overview of the components we will create in order to give the reader a picture of the end situation.
Now you have an overview of all the components and their interactions. The template contains a userform for user interactions. The userform will retrieve and store its information mainly from/in the customXML. In the body text the Content Controls will take care of displaying this information. The customXML can also be used to populate content controls in the text and the userform.