Home > Articles > Home & Office Computing

  • Print
  • + Share This
This chapter is from the book

Customizing Existing Template Parts

Now that you know how to use template parts in your form templates, the next thing you'll probably want to do is go out to the Web and find some interesting template parts that you can reuse. There is no doubt that, when you do, you'll want to modify an existing template part in some way. For example, you may want to add your company logo, change or add some data validation, change the name of the template part, or simply change the icon.

Customizing an existing template part is very easy. When you find the template part you want to change, the first thing you'll probably want to do is download it to your computer (and pay for it if it isn't free). Then, you just open it in design mode in InfoPath as you would for any other template part. Once you make the changes you want, the next thing you'll obviously want to do is save. However, when you save, at this point you haven't created a new template part. All you've done is update an existing one. That means that if you then distribute this component to your users who happen to be using the original one, when they install your component and open a form template that uses the original one, they will be warned by InfoPath that an update is needed.

Maybe this is what you want. It is more than likely, though, that this isn't what you intended. Instead, you probably wanted to create a completely new template part based on an existing one. The one thing to remember is that a template part has an ID that uniquely identifies the component. (Refer back to Figure 10.13.) When you create a new template part, this ID is generated automatically for you. When you customize an existing part and save it, the ID does not change. Therefore, in order to create a new template part, you must change the ID. (It's also a good idea to change the name as well. In fact, when you change the name of the template part the ID is automatically changed. This is one easy way to create a new template part based on an existing one.) Figure 10.17 shows the Template Parts Properties dialog again, but this time after we changed the name and ID of the template part.

Figure 10.17

Figure 10.17 Template Part Properties dialog after changing name and ID

The name is simply a string and can be any name you choose. The ID is a Uniform Resource Name (URN) that uniquely identifies the template part. As you can see from Figure 10.17, the URN contains the name of the template part, the date, and the time, which helps to uniquely identify the template part.

If you want to create a new template part, you must change this URN. For example, you could change the name part of the URN and the date and time by hand. (You'll notice that when you change the name of the template part, the ID changes as well, but not vice versa.) If you decide that you want to regenerate the template part ID based on the new name you entered, just click the Reset button. Once you change the URN and save, you have a completely new template part. (Of course, since it's possible to manually edit the template part ID in the Template Part Properties dialog, it is also possible to enter the ID of an existing template part. This is only useful if you want to overwrite an existing part and not create a new one.)

  • + Share This
  • 🔖 Save To Your Account