InfoPath 2007: Creating a Template Part

Creating a basic Template Part in Microsoft Office InfoPath 2007 is a simple process.  However the rewards that come along afterwards when you have a nice library of template parts is quite nice.  In this post I will give a high level walkthrough of the steps it takes so you can see yourself how easy they are to create and hopefully recognize a few of the benefits of possibly a little work upfront.

Creating a Template Part in InfoPath 2007

Open InfoPath 2007 and select to Design a Form Template

Design a Form Template in InfoPath 2007
You are given a choice to create either a complete form or a template part.  Because the component you are going to create will be used in multiple forms, it makes sense to package it as a template part instead.  In this example, I will create a template part for contact information since it is contained in probably half the forms I make.  Even if some slight items change, using a template part will give me a good starting point.

By selecting template part, you are given a choice to create from a blank template or based on an XML document or schema.  In this case we will select Blank.

InfoPath 2007 Create a Template Part
You design your form by adding the appropriate layout tables and controls to the form.  It is always a good idea to begin this step with a sketched out idea of what your form will look like on paper and the data the form will collect including any dependencies or connections identified.

Similar to a complete template, you can import data from other data sources such as SQL, web services or SharePoint.  In this case, I have a list of provinces contained on a centrally available SharePoint site so I will utilize that.  You never know when Canada could decide to recruit a new province or territory so its important to make it easy for this listing to stay up to date.  OK So maybe in this case I just hate typing so it’s easier for me to grab this information from a central listing somewhere.

 

After all my labels and controls have been added, I am ready to save my template part.

InfoPath 2007 Save Template Part

When you save the template part you will notice it has its own unique file extension (xtp) rather than the xsn you would see if you were saving a complete form.

InfoPath 2007 File Extension xtp for a Template Part

 

Now whenever I want to create a form that contains contact information, I can simply add my template part instead of recreating every single field manually.  Who has time for manual recreation of common elements when there are Stanley Cup Finals or World Cup Soccer games to watch? 

Below the controls listing on the task pane select the link to “Add or Remove Custom Controls…”

InfoPath 2007 Add Custom Controls

Select Template Part from the wizard screen…

InfoPath 2007 Import a Template Part

Browse to the location of your template part.  If you are working on a team, then it would be a good idea to store these in a central location so as to be a library for everyone to use.

InfoPath 2007 Select Template Part for Upload

And Voila you have a new custom control available to you in the task pane.

InfoPath 2007 - Template Parts

InfoPath 2007 Template Part 

 

Just like any other control, click and drag it onto the form to make it appear.  

 

Depending on the complexity of your template part, you can evaluate the benefit of using template parts by comparing the length of time it takes to click and drag versus the length of time it took you to add all the controls and set up your data connection, then multiply it by the number of times you would typically have to add those fields to a form.

9 comments on “InfoPath 2007: Creating a Template Part

  1. Excellent post on the new template part feature!

    Cheers,
    == Eric

  2. amanda says:

    Thanks Eric – great blog btw!

  3. W0ut says:

    My infopath doesn’t automatically add the xml elements of my template part info the maindata source of my main infopath form. It asks to which part it should bind. (main data source is still empty)

    Any Ideas?

  4. Umakanth Nelige says:

    Hi Amanda,
    Im just wondering, if we have the option of creating templates(.XTP) in infopath – 2003??

    -Umakanth Nelige

  5. Hi Umakanth,

    Unfortunately this feature was not available in 2003. Hope this helps.

    Amanda

  6. Andrea Young says:

    Amanda,
    I’m getting ready to start on a large project and thought you might know the answer to this question. First a little background to explain the situation. I work for a school district with 80+ schools. Each year our schools are required to fill out a School Improvement Plan, which is basically a detailed form. In the past they were done in word and emailed back and forth and it was a mess. This year I want to create the form in infopath 2007 and I’ll have the form saved in a sharepoint document library for each school. This way they can go back to modify, since it takes them a couple of months to complete the plan. I have that part working fine. Here is my question. To start I have created one “master” form. Each school gets a form based off the master so now my document library has 80 forms. Now all of a sudden the superintendent decides to change some of the verbiage in the School Improvement Plan. Since the forms are already saved in the document library 80 time, I have to go into 80 forms and make the change. If I were using template parts, and I made the change in the template part, would it propagate through the 80 saved form in my document library? I would really appreciate your input on this matter. Thanks

Leave a Reply