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:
-
Enable users to highlight, emphasize, or format the text that they type into a form.
-
Enable users to insert tables or pictures in a blank area on the form.
-
Display rich-text information contained in a database or other source of data.
-
Store formatted data as XHTML in the form template's underlying data source.
In the following illustration, a rich text box is used to collect detailed notes from users.
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 that are based on XPath 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.
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.
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.
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.
The following illustration shows how a rich text box looks when it is 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. In the following example, the Notes box on the form is bound to the discussionItemNotes field in the Data Source task pane.
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.
-
On the form template, place the cursor where you want to insert the control.
-
If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C.
-
Under Insert controls, click Rich Text Box.
-
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.
-
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:
-
On the form template, place the cursor where you want to insert the control.
-
If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C.
-
Under Insert controls, click Rich Text Box.
-
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.
-
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.
-
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.
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.
No comments:
Post a Comment