Tuesday, October 25, 2011

How to Reuse the Template Parts?

If you want to base the design of a new template part on an existing template part, you must open the existing template part, change its name in the Template Part Properties dialog box, and then save the new template part with another, distinguishing file name. When you change the template part name in the Template Part Properties dialog box, the template part ID is updated automatically. This ID further distinguishes one template part from another.

1. On the File menu, click Design a Form Template.

2. Under Open a form template in the Design a Form Template dialog box, click On My Computer.

3. In the Files of type list, click InfoPath Template Parts.

4. Browse to and click the template part that you want to open, and then click Open.

5. On the File menu, click Properties.

6. In the Template Part Properties dialog box, enter a new name in the Template part name box.
When you do this, the identifying text in the Template part ID box reflects the new name. The template part ID is generated automatically by InfoPath. It must be unique for each new template part that you create.

7. On the File menu, click Save As, and enter a new file name for the template part.

What are the steps to create a Template Part ?


In the Design a Form dialog box, you can choose to design a template part instead of a form template. If you do this, InfoPath features that aren't supported in template parts are either hidden or disabled so that you aren't tempted to use them in your template part.

1. On the File menu, click Design a Form Template.

2. Under Design a new in the Design a Form Template dialog box, click Template Part.

3. In the Based on gallery, do one of the following:

o To define the data source (data source: The collection of fields and groups that define and store the data for an InfoPath form. Controls in the form are bound to the fields and groups in the data source.) as you design the template part, click Blank.

o To use an XML document (.xml) file or an XML Schema (XML Schema: A formal specification, written in XML, that defines the structure of an XML document, including element names and rich data types, which elements can appear in combination, and which attributes are available for each element.) (.xsd) file as the data source for the template part, click XML or Schema.

Note If you base your template part on an XML document or XML Schema, InfoPath populates the Data Source task pane with fields (field: An element or attribute in the data source that can contain data. If the field is an element, it can contain attribute fields. Fields store the data that is entered into controls.) and groups (group: An element in the data source that can contain fields and other groups. Controls that contain other controls, such as repeating tables and sections, are bound to groups.) that map to XML elements (XML element: An XML structure that consists of a start tag, an end tag, and the information between the tags. Elements can have attributes and can contain other elements.) in the document or schema. The data source is locked. Depending on the document or schema, you might not be able to add new fields or groups to part or all of the data source, or to change certain aspects of existing fields and groups.

4. To make your template part compatible with InfoPath Forms Services, select the Enable browser-compatible features only check box.

5. Click OK.

A new template part opens in InfoPath.

6. Design your template part.

7. When you finish designing the template part, on the File menu, click Save.

What are Template Parts?


It’s a kind of reusable sections in Infopath forms.

A template part is a portion of a form template that can be saved for reuse in multiple form templates. A typical template part consists of controls and a data source (data source: The collection of fields and groups that define and store the data for an InfoPath form. Controls in the form are bound to the fields and groups in the data source.) and may also include features such as data connections (data connection: The connection between an InfoPath form and an external data source, such as a database, Web service, SharePoint library, or XML file. Data connections are used to query and submit data.), data validation (data validation: The process of testing the accuracy of data; a set of rules you can apply to a control to specify the type and range of data that users can enter.), and rules (rule: A condition or action, or a set of conditions or actions, that automatically performs tasks based on events and values in the form.).
By creating and using template parts, you can help ensure that the form templates in your organization are consistent in tone, structure, and behavior. For example, a human resources department might use a single "Contact Information" template part in all of its form templates.

The file extension for template part is .xtp.

To design a template part, you must select the Template Part option instead of the Form Template option in the Design a Form Template task pane. When you open a template part, a (Template Part Design) prefix appears in the InfoPath title bar, indicating that you are in the correct mode for designing a template part.

Unlike a form template, you don't publish a template part when you finish designing it. Instead, you save it as a template part (.xtp) file. Then you can make your .xtp file available to other form designers who will need to use it. For example, you can copy the .xtp file to a file server on your organization's network and then send an e-mail message to form designers that describes the purpose of the template part, where it is located, and how they can add it to the Controls task pane in InfoPath.

When a form designer inserts a template part on a form template, it becomes part of the form template, and a form designer can customize it, if necessary.

Note There is no way to prevent form designers from changing a template part after they insert it on a form template. If you don't want others to customize the template part, you should make that clear when you distribute it.

To insert your template part on an InfoPath form template, form designers must first add the template part to the Controls task pane by using the Add Custom Control Wizard. After they complete the wizard, the template part appears in the Controls task pane, under the Custom heading.

To modify a template part, you open it in InfoPath design mode, make the changes that you need, and then resave the template part. You must then send the updated template part to any form designers who used the original version of the template part. Form designers can use the Add Custom Control Wizard to add the updated version of the template part to the Controls task pane. After they do this, they can open each affected form template and have InfoPath replace the original template part with the newer version.

Note If your organization creates a large number of template parts, you can build a repository of template parts that can be accessed from a common location on a company network, such as a shared folder, a Web server, or a form library located on a Microsoft Windows SharePoint Services site. It is possible to configure the InfoPath settings in the registry so that template parts appear automatically in the Controls task pane for users who have InfoPath installed. To make this happen, you may need to work with your information technology (IT) department, or with someone who is responsible for administering InfoPath in your organization. For more information about this topic, see the InfoPath documentation on Microsoft TechNet. TechNet is the resource that IT professionals use to successfully plan, deploy, manage, and support Microsoft products.

What is Logic Inspector?


It’s a tool in the Infopath 2007 that shows all of the code dependencies for the form in a single dialog.Depending on how you access the Logic Inspector, you initially see either the overview pane or both the overview pane and details pane.

What are the main components of Infopath Form Services that are responsible for rendering the .xsn file on the Browsers?



The Infopath form services consists of four components that are responsible for rendering the .xsn file on the browsers:

1. ASP.NET modules :Return HTML to the browser.

2. Infopath form services HTTPHandlers:Forward requests from IIS to the Page generator.

3. Converter: Responsible for converting the .xsn file into .aspx pages.

4. Page generator:Communicates with internal data sources and is responsible for processing postback data from the browser and maintaining session states.

What Is the .XSD file in Infopath?

It is the form schema file of infopath.


It determines the format of data that Infopath recognizes.

Architecture of InfoPath forms



An Infopath form template is actually a CAB File containing different component files .

Below are the list of files which forms the part of Infopath Template.

1. .xsf file:A manifest file that describes the basic definition of other form files.

2. .xsl file:Defines the transformation for data into different views.

3. .xsd file:defines the data source schema.

4. .dll file:carries the custom logic built into .net or COM.

5. .htm and other resource files:custom html resource files and other resources for the form.

When a form Template is uploaded using Administrative deployment the template is stored in Content Database of the site.

Office Forms Services provide a server-runtime Environment for Infopath Forms Services.While running on the browser ,all rules ,validations,and calculations are executed in the browser using client-side script.

All business logic is executed on the server.So when a browser requests business logic execution,a postback is executed using low cost XMLHTTP.

FormsServer.aspx is an Infopath forms Services page that accesses the form’s data from the content database and renders it to the client.

Where does the data get stored in Infopath form ?



The data is stored in XML file.

What is the Form View files in Infopath?or XSL file ?

The .xsl file is the form view file that provide a way to represent a different information,depending upon the runtime environment and other factors,including the security profile of end users.

They are based on xml stylesheets that can be formatted depending upon the condition.[Conditional formatting is itself the inbuilt property of XSL]

What is .xsf file?or what is the Form Definition file [XSF Files]? or what is manifest.xsf file ?

It’s a manifest file that provides the basic definition of other form files.This file contains the xml code that describes all aspects of the form.

The .xsf file is automatically created by InfoPath when a new form template is created and saved in design mode. As form designers and developers change the form template or add new features to it, InfoPath updates the .xsf file to reflect those changes.



Note : The .xsf file can also be modified directly by using any text or XML editor, such as Microsoft Notepad. However, care should be taken when making modifications to the .xsf file: if an invalid entry is made, the form that the file is associated with may be left in an unusable state. However, some customizations can be made to the .xsf file that cannot be generated in design mode.



The .xsf file is the core file of an InfoPath form because it contains information about the form as a whole. Some of the data it contains includes processing metadata, user interface customizations, schema definitions, views, business logic declarations, event handlers, and deployment information.



The following are some of the items that the .xsf file contains:



* A unique identifier for the form

* Global metadata information about the form, including deployment and publishing information

* The XML Schema definitions for the XML document that the form produces

* Definition of views and their associated user interface components (menus, toolbars, and buttons)

* Definition of editing actions that are made available using user interface components, and how their availability will be determined contextually

* Workflow and routing information

* Event handlers, data validation, and business logic that is associated with individual XML nodes of the form's underlying XML document, or with the XML document itself

* Event handlers associated with the form as a whole

* Packaging information about all of the files contained within the form template



The .xsf file is based on the xsf namespace. Its root element is the xDocumentClass element.

What is the structure of an Infopath form template ?

The infopath form template (.xsn file) is actually a CAB file [can also be considered as zipped file] containing the different components file of which infopath is built.following are some of the important files contained inside that cab file.

1. .xsf

2. .xsl

3. .xsd

4. .dll

5. .htm and other resource files.

What are the benefits of Infopath 2007 ?



Prior to the introduction of Office 2007 system, the Infopath client application, like other office products, had to be installed on every user’s computer.

In order to develop and use a form,

1. The form had to be designed using Infopath.

2. The resulting form template should be hosted in a network file share or installed individual user machine or uploaded into a form library in sharepoint, from where users can fill the forms.

3. Filling up the forms require infopath to be installed on the client machine.

4. Developing a connected infopath was complicated for end users.

5. Developers didn’t have an integrated development platform.

6. The product didn’t integrate with other office products such as word and excels.

The Benefits of Office 2007

This introduced a new server side runtime to host infopath forms known as Infopath form services.

The new capabilities includes :

1. Ability to convert word and excel documents into infopath form templates.

2. With the help of Infopath form services the Infopath form can be Browser enabled.

3. The new infopath form can be embedded into Outlook

4. The form can be built once and rendered in different modes and devices.i.e. Design Once.

5. Introduction of document information panel.i.e.the infopath form that is hosted inside word 2007,or powerpoint 2007,which can be used to edit document properties.

6. Introduction of logic inspector. i.e the components which provides visual view of all the rules embedded in the form.

7. The new infopath forms can be published to content types.

8. Introduction of template parts.i.e a reusable code sections.

9. Introduction of integrated development environment inside visual studio 2005 using visual studio tools for office.

10. The information right management can be used to protect sensitive data in the form.