Skip to main content

XRRichText.LoadFile(String, XRRichTextStreamType) Method

Loads a file into the XRRichText control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public void LoadFile(
    string path,
    XRRichTextStreamType streamType
)

Parameters

Name Type Description
path String

A String that is a path to the file.

streamType XRRichTextStreamType

An XRRichTextStreamType enumeration value that determines the type of stream used to load the file into the XRRichText control.

Remarks

The LoadFile method automatically recognizes file formats with the following file extensions:

  • .htm
  • .html
  • .rtf
  • .txt
  • .docx

The contents of the control are replaced with the newly loaded data.

The following code snippet creates the XRRichText object in code and loads its content from a file:

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

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

// Calculate its height automatically,
// and make the borders visible.
xrRichText1.CanGrow = true;
xrRichText1.CanShrink = true;
xrRichText1.Borders = DevExpress.XtraPrinting.BorderSide.All;

// Load the control content from a file.
xrRichText1.LoadFile("input.docx", XRRichTextStreamType.XmlText);
See Also