Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XRRichText.LoadFile(String) Method

SECURITY NOTE

Do not load files obtained from untrusted sources. Such files may pose a security risk. Please review the following article for additional information:
Suppress Control Requests to Download Data from External URLs

Loads the contents of the specified file, and recognizes the file format automatically.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

#Declaration

public void LoadFile(
    string path
)

#Parameters

Name Type Description
path String

A String that is a path to the file.

#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.

Note

To load the contents of a file as plain text, call the LoadFile method with the XRRichTextStreamType.PlainText parameter.

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();

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

// Load the control content from a file.
xrRichText1.LoadFile("input.rtf");
See Also