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

XtraReport.LoadLayout(String) Method

Loads the report’s definition (layout and configuration) from a file in the REPX format.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

public void LoadLayout(
    string fileName
)

Parameters

Name Type Description
fileName String

A String value specifying the path to the REPX file to be loaded, containing the report’s definition.

Remarks

A report definition contains all report settings, as well as settings of report controls. To save a report definition to a REPX file or a stream, use the XtraReport.SaveLayout method.

Important

Deserialization of reports obtained from untrusted parties can trigger execution of malicious code that can either be directly embedded into the report definition, or contained in an external assembly referenced by the report.

To avoid this, we recommend that you use XML serialization instead of CodeDOM (in this case, reports can be safely deserialized by using the XtraReport.LoadLayoutFromXml method instead of a less secure LoadLayout method) and prevent any untrusted third-party libraries from becoming available on the server.

When a reporting application is deployed under the Medium Trust permission level, XML serialization is the only option to save reports (CodeDOM serialization is not supported in such environment).

To learn more, see Storing Report Layouts.

Example

This example demonstrates how to save a report definition to a REPX file (by using the XtraReport.SaveLayout method) and how to load this definition (by using the XtraReport.LoadLayout method).

using DevExpress.XtraReports.UI;
using System.Windows.Forms;
// ...

// A temporary path to save a report to.
string filePath = @"C:\Temp\XtraReport1.repx";

private void button1_Click(object sender, System.EventArgs e) {
    // Create a report.
    XtraReport1 report = new XtraReport1();

    // Save a report's layout to the configuration file.
    report.SaveLayout(filePath);
}

private void button2_Click(object sender, System.EventArgs e) {
    // Create a report.
    XtraReport1 report = new XtraReport1();

    // Load a report's layout from the specified file.
    report.LoadLayout(filePath);

    // Display the print preview.
    ReportPrintTool pt = new ReportPrintTool(report);
    pt.ShowPreviewDialog();
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the LoadLayout(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also