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

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

Declaration

[ToolboxTabName("DX.18.2: Report Controls")]
[ToolboxBitmap(typeof(XRRichText))]
[XRDesigner("DevExpress.XtraReports.Design.XRRichTextDesigner,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
[XRToolboxSubcategory(0, 2)]
[ToolboxBitmap24("DevExpress.XtraReports.Images.Toolbox24x24.XRRichText.png,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
[ToolboxBitmap32("DevExpress.XtraReports.Images.Toolbox32x32.XRRichText.png,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
[ToolboxSvgImage("DevExpress.XtraReports.SvgImages.Controls.XRRichText.svg,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
public class XRRichText :
    XRRichTextBase,
    ISupportInitialize,
    IDisplayNamePropertyContainer
<ToolboxTabName("DX.18.2: Report Controls")>
<ToolboxBitmap(GetType(XRRichText))>
<XRDesigner("DevExpress.XtraReports.Design.XRRichTextDesigner,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")>
<XRToolboxSubcategory(0, 2)>
<ToolboxBitmap24("DevExpress.XtraReports.Images.Toolbox24x24.XRRichText.png,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")>
<ToolboxBitmap32("DevExpress.XtraReports.Images.Toolbox32x32.XRRichText.png,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")>
<ToolboxSvgImage("DevExpress.XtraReports.SvgImages.Controls.XRRichText.svg,DevExpress.XtraReports.v18.2.Extensions, Version=18.2.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")>
Public Class XRRichText
    Inherits XRRichTextBase
    Implements ISupportInitialize,
               IDisplayNamePropertyContainer

Remarks

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.

Shared_FormattingToolbar

XRRichText_2

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.

rich-text-expression-editor

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.

Examples

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;
}

Implements

DevExpress.XtraReports.Serialization.IXRSerializable
DevExpress.Utils.Serializing.Helpers.IXtraSupportDeserializeCollectionItem
DevExpress.Utils.Serializing.IXtraSerializable
DevExpress.XtraReports.Native.IDisplayNamePropertyContainer
See Also