Creating a schema using the Word Content Control Toolkit
Video: Creating a schema using the Word Content Control ToolkitI've created a special version of our Letter of Agreement template that has some markup on it so that we can take a look and see what we're doing here. I'm going to slide into the Developer tab and switch into Design mode so that you can see that I actually have at the top the content controls that I'd used to capture dates, the legal name, the computer short name, and so on. But each of these appears only once in this template. Well I want to repeat for example the company short name, I've simply highlighted that in yellow and there are many places that company name will appear in this document.
- What's next
Viewers: in countries Watching now:
In this course, author Gini Courter introduces the form creation tools found in Word 2010 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 check 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 2010 Essential Training
- Setting up a form
- 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
I've created a special version of our Letter of Agreement template that has some markup on it so that we can take a look and see what we're doing here. I'm going to slide into the Developer tab and switch into Design mode so that you can see that I actually have at the top the content controls that I'd used to capture dates, the legal name, the computer short name, and so on. But each of these appears only once in this template. Well I want to repeat for example the company short name, I've simply highlighted that in yellow and there are many places that company name will appear in this document.
Likewise, I have a servicetype that's in here, but once I've selected this once, I want it to repeat here, here, and here in the document. So again, here's my template all ready to go with one set of content controls in it. No content control is repeated and for my ease-of-use I've marked this document up using the Highlight tool, but you don't have to. If you're working with an existing letter of agreement or contract, you probably have one that already has the short name of the company every place else.
Simply go in and the first time it occurs, replace it with your content control so someone can enter the short name for the company and you're in the same place I am, all ready to go. So I'm going to make sure that we save this template. I'm going to close it and I'm ready to create my schema. So I'm going to open the Word 2007 Content Control Toolkit and I'm going to open my template. Make sure I'm not opening the document here. I'm actually opening the template. Now the Content Control Toolkit goes and looks for all of the different content controls and says okay, this is what they look like.
It list them here on the left. On the right, it allows me to create a schema. Before we jump in and create this, I actually want to provide some information on how schemas are organized so you can think about this. There are different kinds of data here. I have legal name and company short name that I'm collecting from the user. Those are both attributes of the company. While servicetype, service startdate, Servicecity and so on are more attributes of the encounter or the actual service that's been provided.
We can organize those instead of having a flat list of all of our data like they have here. We should actually organize this so that our data looks easier to understand and to show that some kinds of data here are related to each other. That brings us to the concept of how schemas are organized for XML files. Here are the fields that we have and again, we could simply say I've got a legal name, I've got a company short name, and so on. But we know that they are in fact, rolled up into larger containers.
We don't have any content control for companyinfo and yet we can infer that it exists. We don't have a container for serviceprovided and yet because all of these items are services, servicetype, startdate, and Servicecity, we can infer that they exist. And always within an XML schema we will have at the top one large container holding it all called the root. Each of these items is called the node. This is the root node. We have the companyinfo node, the serviceprovided, the legalname node and so on.
That's just language about how schemas are organized. First, we'll click Create a new Custom XML Part and then we'll switch to Edit view. Now here's that root container. We can't do without it, and we need to create all the containers that lie underneath it. So I'll start by saying that I have a submit date. This is this tag over here. I'm going to get to match or map each item I put here, each node, with a particular tag over here belonging to a content control.
Therefore I don't have to use the same text, but it's easy if I do. In markup language like HTML or XML, we begin by typing the less than sign, then the name, and then we close it. That actually opens up the tag and we can put things in here then if we wanted to. Or we can say I'm actually done with this tag and we can close it. We close it by typing the less than again, and a forward slash and using exactly the same name and closing it again.
So now we have a start and an end tag. Now when we look at this, if I put anything between them, I'm actually putting in a default value. So in some controls for example, I might type something like today's date. In the date picker I'm not going to see much, but let's roll that back to the point where I've just closed this, okay. Now I'm going to put in the second set of fields. I'm going to go ahead and open up the tag and remember that we had companyinfo.
It's not a field that we have, but it's a grouping. It's a node. So there's my companyinfo starting tag, and now I'm going to start adding the legalname of the company and then I can close this off with another legalname. Close tag. If I put any information in here, it will actually serve as a default value or as a placeholder. Now my content controls that I have in Word have placeholders. But I will tell you that they're not going to show up once we've created this schema.
One of the unfortunate consequences of using the schema is that our placeholders are going to be overwritten and we won't be able to get them back. So it's not a bad idea to go in here and to say Enter legal name of company, or to say Enter form submit date. So there's our legalname, start tag, end tag.
Next, I have the company short name and if I don't want to use the tab, if I'm way over here on the right, I could just as easily hit the Spacebar once or twice as the Tab key once or twice. So this is the company short name, but I don't have to give it that full thing. I can just say shortname and I can say Enter short name. This will directly follow on Enter legal name of company, so folks will probably figure it out. Now as I'm doing this, I want to make sure that however I spell shortname here.
I spell it exactly the same way here. I'm going to make a mistake so that you can see it later on and I'm going to go on and enter the opening tag for info about the service. So I have things like servicetype. Or it's actually a drop-down list. I could say Choose service type and then close it off.
Now I have startdate. Now I can cut, copy, and paste in here if I wish. So if I want to just copy this and use it again in a second that's a fine thing to do. I can select it that way or I can double- click, but that will leave the tags out. So I'm just going to grab this, hang on to it for a second, okay, and then I can paste it back in and that makes it very easy for me simply to go in here and to drop the closed tag in. I also have fields like servicecity, enddate, trainingcenter.
That's another drop-down list. I am going to make another mistake here, so that we have something else to look at when we're done. I have a materials list and so on. So I'm going to paste all of the rest of this when we're done, but right now I'm going to go ahead and I'm going to check my syntax to make sure that this is all okay. And first it says, "The 'servicetype' start tag on line 7 does not match the end tag of 'serviceinfo' at position 37." So it says, the servicetype start tag in line 7.
1, 2, 3, 4, 5, 6, 7, and it says you've get a problem somewhere in here. Now it's pointing to servicetype and that's because down here I type serviceinfo. So this needs to say servicetype instead. And you begin to see why you would bother to check this. So let's check it again now and it says the traincenter start tag on line 11 does not match what you put here at the end, the end tag, all right.
I only put two more mistakes in here, so let's check in again. Now it says the serviceinfo start tag here does not match up with root. Oh my, look it. I never closed this group off. We knew that at the time. So I am going to go back and close the serviceinfo container. That's up here and one more. I never closed the companyinfo node either. So let's go put a close tag on for companyinfo.
Make sure always that you check. It's easy to type something incorrectly. It's easy to miss closing a node. Now there are no syntax errors found. So we know that this is just fine to use. If you haven't exported this to an XML document, you might want to do that. particularly if you need to stop at this point, I'm going to keep on going in the next movie, and we're going to bind each of our nodes back here to our content controls. But if you close the Word 2007 Content Control Toolkit before you do your binding, then you'll have to be able to load the XML file again.
See you in the next movie!
There are currently no FAQs about Word 2010: Forms in Depth.