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" ?>
<label>Line 1
Line 2
</label> - In InfoPath, create a Receive 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.

Comments to this post were closed 30 days after it was published.