5 InfoPath questions about controls, XML, and Excel

Filed under: InfoPath 2010

The following five questions about InfoPath controls, XML, and InfoPath with Excel were recorded as search queries to BizSupportOnline and S.Y.M. Wong-A-Ton has taken the time to answer them.


1. How to change control in InfoPath?

You can use the Change Control context menu item on a control or go to Properties > Modify > Change Control and then select the control you want to change a control into.

Note that only controls that are compatible with the data type of the field bound to the control you are changing will be available in the list of controls to choose from.

2. Can there be rules as well as code-behind for a button on an InfoPath form?

Yes, you can have rules as well as code running behind a button. However, keep in mind that the rules will always execute before the code.

3. How to display an image on selection of an item from drop-down using InfoPath form?

You can use the same technique I used in a video tutorial called Change an image on an InfoPath form by selecting options to be able to select images by selecting an item or an option. Note that you would have to replace the option buttons (displayed in the video tutorial) by a drop-down list box control.

4. How to convert XML file into XSN?

You can use the XML or Schema form template type when you create a new form template in InfoPath Designer 2010 to be able to base a form template (XSN) on the structure of an XML file. Because the data types used in the XML file would not be automatically taken over by the form template, a better option would be to base the form template (XSN) on the XSD (XML schema) of the XML file instead of on the XML file itself. I used a similar technique in a video tutorial called How to convert an InfoPath 2003 form template to InfoPath 2010.

5. How do I create a new InfoPath form for every row in Excel?

You can write VBA code in Excel to create InfoPath forms and then fill those forms with data from rows on an Excel worksheet. InfoPath forms are XML files that are linked to XSN files, so you would have to write VBA code that can generate such XML files. Recipe 39 in InfoPath 2010 Cookbook 5 shows you how to do this, but you can also search MSDN for VBA code to create XML files.


Related Posts


Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author.

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services