Creating a schema using the Word Content Control Toolkit
Video: Creating a schema using the Word Content Control ToolkitHere's my template now and I've prepared it so that I can begin working with a Content Control toolkit. I'd like to show you what I've done with this document. First, I went into Design mode and made sure that I entered a content control for every single piece of data I wanted to capture from the user, but only the first time that I wish to capture the data. So for example, the Company Short Name field appears here and several other places in the document. I've only entered one control for Company Short Name.
- What's next?
Viewers: in countries Watching now:
In this course, author Gini Courter introduces the form creation tools found in Word 2007 and shows how to produce electronic forms that are visually pleasing and easy to navigate. The course covers designing a form; capturing data effectively with dropdown lists, date pickers, and text boxes; and adding controls for repeating data using the Word Content Control Toolkit. The course also includes tutorials on testing, protecting, and distributing forms.
Prerequisite Course: Word 2007 Essential Training
- Customizing pre-built Microsoft.com templates
- Inserting content controls
- Saving a form as a template
- Troubleshooting form issues
- Understanding Building Blocks
- Creating a schema using the Content Control Toolkit
Creating a schema using the Word Content Control Toolkit
Here's my template now and I've prepared it so that I can begin working with a Content Control toolkit. I'd like to show you what I've done with this document. First, I went into Design mode and made sure that I entered a content control for every single piece of data I wanted to capture from the user, but only the first time that I wish to capture the data. So for example, the Company Short Name field appears here and several other places in the document. I've only entered one control for Company Short Name.
Every place else that I want to use the Short Name control, I've simply highlighted it in the same color, in yellow. Likewise I choose a Service Type in the first paragraph and then use it again, twice more. There's a Start Date that's entered here, that's used again, and the Legal Name of the company is repeated down here in the signature block. This is important, because you don't want to have multiple copies of a control when you begin with the Word Content Control toolkit. I have this document all marked up as I would like.
You don't need to highlight these, but as you'll see in a couple of movies, as you'll see two movies from now, when I actually am adding copies of the control it's really nice to be able to move quickly through the document, because I've highlighted already every occurrence of these controls. So take your template, make sure that you have only one unique control for each type of data you're entering. One control that has first name, one for last name. If there are duplicates, remove them and simply put in something like last name or short name, highlight it, and you'll be all set.
I'm going to go ahead and save my template. Now we'll start the Content Control toolkit. This is a very basic Window, I'm simply going to choose File > Open, and go back and get my Letter of Agreement template that I just saved. When I open this, the Content Control toolkit automatically reads every single one of those content controls and lists them here. These are the tags that I entered as the property of the control, and if I want to see it all, I can go ahead and select and widen this list.
It's a good idea at this point, to make sure that there are no duplicates here. We're now ready to create a schema. We're told there are no Custom XML parts in this document. Click here to create one or click here. Immediately, there is a stub of a new XML schema created. We're going to go to the Edit view to finish creating it. But first let's take a moment and learn a little bit about schemas. Schemas are used to organize your data. So we could simply list each data element, but we don't want to do that.
We'd like to actually organize them together, group them, particularly if you have a long document with many, many elements. This isn't grouping based on how they're entered in a document, but it's grouping simply based on how they hang together. So, for example, we have content controls that capture the legal name of the company, a short name or nickname for the company used in the contract, the type of service, the start date, the service city, for example, but those aren't all about one thing. The legal name and the company short name are info about the company.
The service type, start date, and service city are specific to this contract. They're about the service that will be provided. Finally, there's another field in there called Submit Date that has nothing to do with the company or the service provided; it's simply related to the form. So what we can do, is we can cluster this information together. We can abstract a category called Company Info that encapsulates legal name and company short name. We can abstract service provided. We won't actually ever have a control in our template called Service Provided, and yet that's a good way to think of what service type, start date, and service city have to do with.
Each of these boxes represents something that in XML is called a node. So legal name, company short name, and service type are nodes within the node called Company Info. There is a high-level singular node then in every schema that is called the Root. So every piece of information we enter will be part of the root. It has no peer. Within the root then we'll have three clumps of things; Company Info, Service provided, and Form, and within those we'll have other smaller nodes.
When you enter information into a schema, there's a specific way that you have to do it. Every element has to have tags, a start tag and an end tag that identify here's where this data begins, here's where this data ends and this is what it's called. When you type a schema you'll begin by typing the less than symbol and the name of that node, for example, legal name, first name, service date, and so on. You'll then type any default value you would want to have displayed in the form by default.
Those wonderful placeholders that we have in our Word form are going to be wiped out by the Word Content Control toolkit. So there will be no default value anymore. We have to enter one if we would like to have one. So, for example, we might enter Type city name here. We'll then type an end tag and I want you to notice that the end tag is identical to the start tag except it begins with a slash, a forward slash. So you type less than (<), forward slash (/), and the same tag that you had for the start tag, and then the greater than (>) symbol.
Now if you don't ever intend to put a default in there, if you're happy to just have an empty spot, then what you can do is you can shorten this process. You can type the tag, close the tag, and that's all you need. So this second option totally takes the place of typing a start tag, some default text, or some default value and then an end tag. Let's return then to the Word Content Control toolkit and build the schema that corresponds to the content controls that are in our template.
Here you see the root with a tag at the start and a tag at the end. I'm going to go ahead; everything I type will go between the start and the end here. So the first thing I want to do is I want to note that I have a form. So I'll do an open tag for the form and in this form I actually have one element and that element is the Submit Date. So one way you can do this is you can just hit the Spacebar a couple of times to move this over, or you can hit the Tab key and it will move it way over. So there's the opening for our form container, and then I'm going to put in a submit date, there's the opening tag.
Now, I don't want to put any text in here necessarily. I could. I could Choose a date, for example, and that will make sure that you can actually see that field. Then I'll go ahead and begin the close tag which will also say submit date. You can copy and paste in here if you want to. Now I'm going to go ahead and close the Form tag, So these two items are parallel. Now I'm going to open up that next higher level node, which was information about the company or the client.
So let's just call it companyinfo. There is our tag. Over here I can see that I have fields like company short name, legal name. I do not have to use exactly the same name. So I'll actually know this is part of company info. So let's say legalname and I'm going to type Enter legal name, and I'm going to go ahead and close that tag and now we have the short name. Even though it's called comp short name here I can simply call it short name here.
Enter short name, and then close that tag off. Again, if you'd like to do copy and paste after you type short name, you can select it, copy it, come here, paste it and then all you have to remember to do is to go ahead and put the slash in here. That's really all the info that we have that is solely about the company. I'm going to make a mistake now and we'll come back and I'll show you how this will be caught and corrected later. Now we're going to put some information in that is about this particular service.
So this is service info. Again, these don't exist in terms of control so I have some freedom. I'd just like to do something specific and it's understandable, but brief. The rule in XML is that these should be what's called human-readable. You should be able to look at this and have a clue what it is, even if you know very little about the business that this has been written for. So we have a service type and I could say, Choose a service, and close that tag set, and then I have a startdate and I could just say Choose start date.
I've made another mistake that we'll grab later on, and I have a service type, start date, service city, end date. It make sense to put the enddate here as well. Choose enddate, because those will come up next to each other. Then I have a training center and all of these are dropdowns. You'll notice that I'm using the word Choose for dropdowns and Enter for places where people would type, and so on. So I have a number of items to enter.
I don't actually have to enter every single item that's in my list. It's a good practice to do that, but I don't have to. So I'm going to go ahead and close this service info tag. If at any point it would help me to go back and look at my form, there's actually a button that will let me do that . I can click here and I'll ask that to save it, so that it's in sync with the viewer or not. It doesn't matter. It will actually show me the content controls, and then I can click on one and it will show it to me here in the viewer, which is kind of a nice thing to be able to do to see every single item that's in here.
I'll go ahead and close that again, because I need to close it to be able to save it when I'm all done. But I'm not done yet; I want to check the syntax of my schema to make sure that I did a good job with my start tags and my end tags, and so on. I'm actually going to go make one more mistake in my schema first, so you can see how these get caught. So I'm going to click the Check Syntax button, and it says the form start tag on line 2, that's here, does not match the end tag of frm, Line 4, position 4.
Now position 4, actually the tab is one position, and then you simply read in. But I'm going to say, oh, I see what I did, there is no o the second time. So I fix that. Then I go ahead and check the syntax again. It says the startdate tag on line 10 does not match the end tag of serviceinfo, and you might wonder where is serviceinfo? How does that work? When it tells you that a starttag and an endtag don't match and it's not the same, the odds are good that you've missed tagging the ending.
So I have start date and at the end here I don't have a close tag. So always look to make sure whatever it's flagging, that the corresponding tag, it'll flag the start tag, go look at the end tag. If it flags the end tag, go back and look at the start tag. Let's check again, and we'll find that the companyinfo tag on line 5 does not match the ending tag of a root. So where's my closing tag for companyinfo and the answer is, I didn't put one in. So let's go down now and copy this companyinfo tag and go ahead and repeat it, and I will need to close that.
When I checked this last time there are no syntax errors found. This is what's called well- formed XML. It's good enough. It passes the test. It's not at all confusing to Microsoft Word, or to the Word 2007 Content Control toolkit, or to the Content Control toolkit. It understands what I've laid out here in terms of my data, that I have in the root a bucket or a group called Form that has one control in it, another bucket called companyinfo with two controls, and then finally a serviceinfo bucket that has four controls. So I'm all set.
This looks good . I've now created my schema. I'm going to do one more thing, which is I'm going to actually export this XML schema and save it so I have it. So let's go ahead and save this and I can give it the same name as my document. It will have an ending of .XML. I'm going to save this, but I'm not going to close the Content Control toolkit, because I'll be right back in the next movie to show you how we're going to bind our schema to our Content Controls.
There are currently no FAQs about Word 2007: Forms in Depth.