Quick Tip: Display button text on two lines in InfoPath
Learn how you can use a secondary data source to display text on two lines on a button in InfoPath thereby creating a multi-line button label in InfoPath.
Once in a while I go through the log files of my InfoPath website and sometimes I find some interesting things that InfoPath or SharePoint users want to do with Microsoft products.
Recently I found the following search query in my logs: button text infopath two lines.
While it is not always clear to me what a searcher is/was looking for, sometimes the queries are descriptive enough that I can get an idea of what a person is trying to do.
So I decided to have a bit of fun today and write a post about how you can place the text that goes on a button – more officially called a "label" – on two lines on the button in InfoPath. It’s kind of a workaround, but I hope you’ll find this solution useful.
To display button text on two lines in InfoPath and create a multi-line label:
- Create an XML file that has the following contents (with the line-breaks exactly as you see them here on the screen):
<?xml version="1.0" encoding="UTF-8" ?>
- In InfoPath, create a Receive InfoPath data connection to an XML document, and specify the XML file you created in the previous step.
- Add a button to your InfoPath form template and use the formula button behind the Label field on the Button Properties dialog box to set the value of the button’s text to the label node of the secondary data source to the XML file.
Figure 1. Selecting the label node in the secondary data source to the XML file containing the multi-line button text.
The resulting multi-line button label is shown in Figure 2 with the button text spanning two lines.
Figure 2. Multi-line button text in InfoPath.
This solution works for InfoPath forms that are filled out through the InfoPath client application and through a browser.
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.