The requested page is not available for the requested platform. You are viewing the content for Default platform.

Rich Text

This document introduces the basics of using the XRRichText control in XtraReports, and describes its main features.

Rich Text Overview

The XRRichText control allows you to display formatted text in your report. It can represent static or dynamic text, or both.

In addition to the capability to embed plain text into your report (using the Label control), you may need to display RTF or HTML content as well. It allows you to easily perform extraction of RTF or HTML content from a database field, and load content from a file.


When exporting to XLS or XLSX formats, XRRichText's content is exported as plain text only.

To load RTF or HTML content into the XRRichText control from a file, click its smart tag and in the invoked actions list, select Load File....


Then, in the invoked Open dialog, use the drop-down list to define the file's extension (.rtf, .docx, .txt, .htm or .html), select the file, and click Open.

You can quickly modify the XRRichText control's displayed content using its in-place editor and the Formatting Toolbar.



Bind a Rich Text Control to Data

To display RTF content within an XRRichText control, bind its XRRichText.Rtf property to a data field obtained from the data source. To do this, click the control's smart tag, expand the Rtf Expression drop-down list and select the required data field.


In the same way, you can bind the XRRichText control to a data field that provides HTML content using the XRRichText.Html property. For this, click the control's smart tag and use the Html Expression option. To learn more on HTML support, refer to HTML Tag Support.

Clicking the Rtf Expression or Html Expression option's ellipsis button invokes the Expression Editor, in which you can construct a complex binding expression involving two or more data fields. You can also invoke the Expression Editor and specify the XRRichText.Rtf and XRRichText.Html properties using the Properties window.


To quickly create an XRichText control that is bound to a data field of any type, right-click the corresponding node of the Field List and drop it onto a report band. In the invoked context menu, choose the RichText item.


Note that the mail merge feature is fully supported for the XRRichText control, meaning that you can easily embed data fields and images into its content.


See the Bind Report Controls to Data topic to learn more about available data binding modes and creating data-aware controls.

See Also