Insert a rich text box

If you want users to be able to insert formatted text, paragraph breaks, tables, photographs, or clip art in a data-entry field, you can use a rich text box on your Microsoft Office InfoPath form template.

In this article


When to use a rich text box

Use a rich text box when you want to:

In the following illustration, a rich text box is used to collect detailed notes from users.

Formatted text inside rich text box on form

Related controls

InfoPath includes controls that are similar to rich text boxes but that serve different purposes. To decide which of these controls works best on your form template, refer to the following list:

Text box    Like a rich text box, a text box allows users to type, edit, or view text. Unlike a rich text box, a text box displays only a single line of text by default, and users cannot add formatting elements to a text box, such as bold or italic text, pictures, or tables.

Expression box    An expression box is generally used to display read-only text, to display the value of another control on the form template, or to create formulas (formula: An XPath expression made up of values, fields or groups, functions, and operators. Formulas can be used to calculate mathematical values, display dates and times, and reference fields.) that are based on XPath (XML Path Language (XPath): A language used to address parts of an XML document. XPath also provides basic facilities for manipulation of strings, numbers, and Booleans.) expressions. Unlike a rich text box, an expression box does not store or save data. Therefore, you should use an expression box only if you don't want to save its value or reference it in another formula.

Top of Page Top of Page

The user experience

Like a text box, a rich text box is simply a placeholder on a form, such as a comments box, in which users enter text. When typing text in a rich text box, users have access to many of the formatting features that they are accustomed to using in other Microsoft Office system documents. For example, users can insert a picture or table in a rich text box or apply yellow highlighting to a particular paragraph of text.

To find out if they can format text in a particular field on a form, users place their cursor in the field or select the text in the field. If options on the Formatting toolbar are active instead of dimmed, the users can format the text just as they would in any other Microsoft Office system document.

Top of Page Top of Page

Compatibility considerations

When you design a form template in InfoPath, you can choose a specific compatibility mode to design a browser-compatible form template. When a browser-compatible form template is published to a server running InfoPath Forms Services, and then browser-enabled, forms based on the form template can be viewed in a Web browser. When you design a browser-compatible form template, some controls are unavailable in the Controls task pane because they cannot be displayed in a Web browser.

Although rich text boxes are available when you design a browser-compatible form template, be aware of the following limitations:

  • Partial rich-text formatting is not supported in the browser version of the rich text box. If you see an error about incompatible rich-text settings in the Design Checker task pane, select the Enable browser-compatible settings only check box in the Rich Text Box Properties dialog box. Doing so automatically selects the correct rich-text settings for you.
  • You can enable linked pictures for a rich text box in a browser-compatible form template. However, embedded pictures are not supported.
  • For rich text boxes, the full range of formatting options are available only in supported versions of Internet Explorer, including Microsoft Internet Explorer 6.0 and Windows Internet Explorer 7.0. It is possible for users to edit text in a rich text box in other supported browsers, such as Firefox 1.5 or Safari 2.0, but formatting options are unavailable, including changing the text color and applying character formatting.

Top of Page Top of Page

Insert a rich text box

The procedure for inserting a rich text box differs slightly depending on whether you are designing a new, blank form template or basing the design of your form template on a database or other external 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.).

The following illustration shows how a rich text box looks when it is selected in design mode (design mode: The InfoPath design environment in which you can create or modify a form template.).

Rich text box selected in design mode

Controls can be bound or unbound. When a control is bound, it is connected to a field or group in the data source so that data entered into the control is saved in the underlying form (.xml) file. When a control is unbound, it is not connected to a field or group, and data entered into the control is not saved. When you select or move your pointer over a control, text and a binding icon appear in the upper-right corner of the control. The text indicates the group or field to which the control is bound in the data source. The icon indicates whether the control is correctly bound to that group or field. When the binding is correct, a green icon appears. If there's something wrong with the binding, you'll see a blue or red icon instead.

The data source for the form template consists of fields and groups that appear in a hierarchical view in the Data Source task pane. Rich text boxes are always bound to 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.). In the following example, the Notes box on the form is bound to the discussionItemNotes field in the Data Source task pane.

Relationship between rich text box on form template and corresponding field in data source

Insert a rich text box on a new, blank form template

When you design a new, blank form template, the Automatically create data source check box in the Controls task pane is selected by default. This enables InfoPath to automatically create fields and groups in the data source as you add controls to the form template. These fields and groups are represented by folder and file icons in the Data Source task pane.

  1. On the form template, place the cursor where you want to insert the control.
  1. If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C.
  1. Under Insert controls, click Rich Text Box.
  2. To specify the type of rich text that users can enter, double-click the rich text box that was inserted on the form template, click the Display tab, and then select or clear the check boxes under Available formatting.
  3. To add a label to the control, type text above or to the left of the control, followed by a colon (:).

Insert a rich text box on a form template that is based on an existing data source

If you base the design of your form template on an existing Extensible Markup Language (XML) file, database, or Web service, InfoPath derives the fields and groups in the Data Source task pane from that existing data source. In this scenario, you can insert a rich text box by dragging a field from the Data Source task pane onto the form template or by inserting a rich text box from the Controls task pane instead, as described in the following procedure:

  1. On the form template, place the cursor where you want to insert the control.
  1. If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C.
  1. Under Insert controls, click Rich Text Box.
  2. In the Rich Text Box Binding dialog box, select the field in which you want to store rich text box data, and then click OK.
  3. To specify the type of rich text that users can enter, double-click the rich text box that was inserted on the form template, click the Display tab, and then select or clear the check boxes under Available formatting.
  4. InfoPath uses the name of the field or group as the control's label. If necessary, change the label text.

 Tip   You can also use the Data Source task pane to insert controls. In the Data Source task pane, right-click the field that you want to bind the rich text box to, and then click Rich Text Box on the shortcut menu.

Top of Page Top of Page

Layout tips

Use the following tips to help you refine the appearance, size, and other aspects of a rich text box:

  • To change the size of several rich text boxes at once, select the rich text boxes whose size you want to change, on the Format menu, click Properties, click the Size tab, and then make the necessary adjustments.
  • To decrease the default width at which InfoPath inserts rich text boxes, click View Properties on the View menu. On the General tab, select the Use a custom layout width for this form template check box, and then type a smaller number in the Custom layout width box.
  • To change the border or color of several rich text boxes at once, select the rich text boxes that you want to change, on the Format menu, click Borders and Shading, click the Borders tab, and then make the necessary adjustments.
  • To customize the text that appears in a rich text box, use the Font and Font Size boxes on the Formatting toolbar. To change the font and font size for all of the rich text boxes on your form template at once, select the rich text box that contains the formatting that you want, and then click Apply Font to All Rich Text Box Controls on the Format menu.
  • To see what your rich text boxes will look like with actual text in them, click Sample Data on the View menu. This helps you get a sense of what the form will look like when users fill it out.
  • Use margins to adjust the spacing around the outside of a rich text box. Use padding to adjust the spacing around the text inside the rich text box.

Top of Page Top of Page

 
 
Applies to:
InfoPath 2007