XRRichText.Text Property

Specifies the control's text.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.1.dll

Syntax

public override string Text { get; set; }

Returns

Type Description
String

A String value containing the text associated with the control.

Use the Text property to obtain the XRRichText control's plain text representation of its RTF content.

To obtain the RTF or HTML contents of a XRRichText, use the XRRichText.Rtf and XRRichText.Html properties.

Example

This example illustrates how to define custom line spacing for the XRRichText content by using a non-visual RichEditDocumentServer engine to format an RTF string as required, and then assigning the resulting string (RichEditDocumentServer.RtfText) to the XRRichText.Text property.

using DevExpress.XtraReports.UI;
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using System.Drawing.Printing;
// ...

string filePath = @"C:\\Temp\sample.rtf";

private void xrRichText1_BeforePrint(object sender, PrintEventArgs e) {
    XRRichText richText = sender as XRRichText;

    RichEditDocumentServer docServer = new RichEditDocumentServer();
    docServer.LoadDocument(filePath);
    docServer.Document.DefaultParagraphProperties.LineSpacingType = ParagraphLineSpacing.Multiple;
    docServer.Document.DefaultParagraphProperties.LineSpacingMultiplier = 3;

    richText.Text = docServer.RtfText;
}

See Also