Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

When you design a form template (.xsn) file, you are creating a single file that contains multiple supporting files. Conversely, when your users fill out a form, they are actually filling out a form (.xml) file, which is based on a form template.

In this article

What you design: the form template

You create form templates in design mode, which is the InfoPath design environment. A form template is a file with an .xsn file name extension. The .xsn file defines the data structure, appearance, and behavior of finished forms (.xml files).

A form template defines a lot of things, including:

  • The controls, labels, and instructional text that appear on the form.

  • The way that controls behave when users interact with them. For example, you might make a particular section appear when the user selects a check box and disappear when the user clears the check box.

  • Whether the form has additional views. For example, if you are designing a permit application form, you may have one view for the electrical contractor, another view for the receiving agent, and a third view for the investigator who approves or denies the application.

  • How and where the data in a form is stored. For example, your form template might be designed to let users submit data to a database, either directly or through the use of a Web service. Or you might have users save their form to a shared folder.

  • The fonts, colors, and other design elements that are used in the form.

  • Whether users can customize the form. For example, you can let users add extra rows to a repeating table, repeating section, or optional section.

  • Whether users are notified when they make mistakes in the form or forget to fill out a required field.

After you finalize the design of a form template, you make it available to your users by publishing it as an .xsn file.

Tip: In addition to designing form templates, you can also design template parts, which are custom controls that you can use in other form templates or Microsoft Office documents. For example, you might create a template part that includes fields for collecting contact information. You could then use that template part in several different form templates. Find links to more information about template parts in the See Also section.

Top of Page

What your users fill out: the form

An InfoPath form is an .xml file that contains XML data. All InfoPath forms are based on form templates.

To illustrate the relationship between a form template and a form, imagine that you designed a permit application form template for electrical contractors to use. Each permit application that an electrical contractor fills out is a form. That form is just an .xml file that contains the data (and only the data) that was entered into the form. All of the other things that make up the form are provided by the form template. This means that whenever your users open a form, that form must locate and use its associated form template in order to function properly. Otherwise, when your users opened a form, they would see only XML markup tags and data.

To link a form template and the forms that are based on it, InfoPath includes several lines of code, called processing instructions, at the top of each form file. This code links the form file to its associated form template.

Top of Page

Components of a form template

A form template is a single file that contains multiple supporting files, such as files that define how controls on the form template should appear, files for graphics that appear on the form template, and programming files that enable custom behaviors in the form template. These supporting files are collectively known as form files. When you design a form template, you can view and work with the form files that make up the form template by extracting and saving those form files to a folder.

The supporting files that make up a form template can include one or more XML Schema files, an XSL Transformation (XSLT) file for each view in the form template, an XML file for the data that appears by default when users first open a form that is based on that form template, script files or managed code assemblies, and a form definition file, called Manifest.xsf.

To familiarize yourself with the files that make up a form template, you can use the following procedure to view the source files for a form template.

View the form files for a form template

  1. Create a new, blank form template.

  2. On the File menu, click Save As Source Files.

  3. In the Browse For Folder dialog box, select an existing folder in which to save the form files, or create a new folder, and then click OK.

    InfoPath saves a copy of the form template as a set of files inside the folder.

  4. In Windows Explorer, browse to the folder that contains the files.

The following table describes the supporting files of a form template. These files are always included in a form template.

File type

File name extension

Description

Form definition file

.xsf

The file that contains information about how the form template is put together, including the XML Schemas that it uses and the resource files that it contains. InfoPath automatically generates this file when you design a new form template. As you design and modify the form template, the file is automatically updated to reflect your changes.

XML Schema

.xsd

The file or files that constrain and validate the data in a form template. The contents of XML Schema files — the elements, attributes, and so forth — are represented by groups and fields in the Data Source task pane. Each data source that is associated with a form template, including the main data source, has a corresponding .xsd file.

View

.xsl

The XSL Transformation (XSLT) files that are used to present, view, and transform into HTML the displayed data that is contained in the form that your users fill out. When you work with the different views of a form template, you are actually looking at different HTML representations (or transformations) of the data that is displayed in the form.

XML template

.xml

The file that contains the data that you want to appear by default in specific controls. Users see this data when they first open a form and until they select different values in the controls.

In addition to the files in the previous table, a form template can include any of the files in the following table, depending on the form template's design.

File type

File name extension

Description

Presentation

.htm, .gif, .bmp, and others

The files that are used to show custom task panes or pictures within the form template.

Business logic

.js, .vbs

The files that contain scripts for implementing specific form behavior. These script files are either Microsoft JScript or Microsoft Visual Basic Scripting Edition (VBScript) files.

Binary

.dll, .exe, .cab, and others

The external files that provide programming code and additional business logic. For example, if you create a custom control for your form template, you might need an installation program in order to automatically install and register that control on your users' computers. Binary files are not created in InfoPath, but in programs such as Microsoft Visual Studio .NET.

InfoPath automatically updates the form files when you make changes to your form template. However, if you are experienced with XML, or if you are an advanced form designer, you can extract the individual form files and customize them by hand. For example, you might want to manually modify a set of form files in the following types of situations:

  • You want to reuse the form template's XML Schema (.xsd file) in another Microsoft Office program. For example, you can add the InfoPath .xsd file to the Schema Library in Microsoft Office Word 2007. You can then map elements from the InfoPath .xsd file to the content of a document.

  • You want to create a toolbar in the form template that contains custom commands in addition to the built-in commands that come with InfoPath. To do this, you need to edit the form template's form definition (.xsf) file.

  • You want to make formatting-related enhancements to your form template that aren't available in InfoPath, such as adding a background image (.gif file) to a button. To do this, you need to edit the form's XML Transformation (.xsl) file.

Top of Page

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×