Skip to main content
A newer version of this page is available. .

XRRichText.LoadFile(Stream, XRRichTextStreamType) Method

Loads the contents of an existing data stream into the XRRichText control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

public void LoadFile(
    Stream data,
    XRRichTextStreamType streamType
)

Parameters

Name Type Description
data Stream

A Stream of data to load into the XRRichText control.

streamType XRRichTextStreamType

An XRRichTextStreamType enumeration value that determines the type of stream to be used for loading data into the XRRichText control.

Remarks

Using different types of streams allows a user to load different types of data into the XRRichText control. The data that is loaded into the control replaces the entire contents of the XRRichText control.

This method can be used to load a file, that has been previously opened into a data stream in the control.

Example

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