A newer version of this page is available. Switch to the current version.

XRRichText Class

A Rich Text control which is used to display formatted text in a report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll


public class XRRichText :
Public Class XRRichText
    Inherits XRRichTextBase
    Implements ISupportInitialize,


The XRRichText control does everything the XRLabel control does, and can also apply formatting - not only to the entire text, but to any part of its content. Such formatting includes setting the font used, font styles and font sizes, and at design time, it can be easily applied using the XtraReports Formatting Toolbar.



The XRRichText control also allows a user to load and display files saved in RTF and DOCX formats.

Moreover, basic HTML tags interpretation is supported, and you can load HTM (HTML) files into this control, as well. To learn more on HTML support, refer to HTML Tag Support.

To bind the XRRichText control to a data field with RTF or HTML content, use the control's XRRichText.Rtf and XRRichText.Html properties. And if required, you can apply a format string to these fields.


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

For more detailed information on using this control, see Rich Text.


The following method demonstrates how to create an XRRichText object, set some of its properties, and then save its contents to a text file.

using System;
using DevExpress.XtraReports.UI;
// ...

public XRRichText CreateXRRichText(){
    // Create an XRRichText object.
    XRRichText xrRichText1 = new XRRichText();

    // Set its height to be calculated automatically,
    // and make its borders visible.
    xrRichText1.CanGrow = true;
    xrRichText1.CanShrink = true;         
    xrRichText1.Borders = DevExpress.XtraPrinting.BorderSide.All;

    // Create an array of lines and assign it to the rich text.
    string[] boxLines = new String[3];
    boxLines[0] = "Line 1";
    boxLines[1] = "Line 2";
    boxLines[2] = "Line 3";
    xrRichText1.Lines = boxLines;

    // Export its contents to a text file.
    xrRichText1.SaveFile("output.txt", XRRichTextStreamType.PlainText);

    return xrRichText1;


See Also