Load Report Layouts

  • 4 minutes to read

This document describes how to load report layouts in the Visual Studio or end-user Report Designers.


See Store Report Layouts for general information on storing reports.

Loading Reports using Application GUI

You can load a report definition in the Visual Studio Report Designer by clicking the report’s smart tag and selecting Open/Import in its actions list.


In addition to opening DevExpress reports, the Import Report dialog displayed in Visual Studio enables you to import reports produced by third-party vendors. This option is not available in end-user Report Designers.



Desktop (WinForms and WPF) end-user Report Designers provide Open buttons for loading reports.

The Web Report Designer provides this button after implementing and registering a report storage.

When applying a serialized layout to an existing report, you can update data bindings in the opened report and match them to the current report’s data sources.

Loading Reports in Code

You can use the following API to load reports and report style sheets in code:

Recommended API

Legacy API


Loads an XML containing a report’s layout from a file or stream.


Loads a report’s layout from a CodeDOM object model contained in a file or stream.

XtraReport.FromFile and XtraReport.FromStream

These static methods create a new report instance and apply a new layout to it.

When creating a report using these static methods, your application must be able to locate and identify the report’s class type (its name is stored in the report definition’s header). This type is searched for in the following assemblies (in this order):

  1. The assembly (an EXE or DLL file) that produced the report definition (the report definition’s header specifies its path).
  2. The current assembly from which the corresponding static method was called.
  3. Other assemblies referenced by the current assembly.

These methods create a new XtraReport‘s instance if they fail to identify the class type, and load the specified report layout to it.


Loads an XML containing a report’s style sheet from a file or stream.

XRControlStyleSheet.LoadFromFile and XRControlStyleSheet.LoadFromStream

Loads a report’s style sheet from a CodeDOM object model contained in a file or stream.


We recommend using XML serialization to prevent unauthorized code injections into a report’s definition and execution of harmful code on a client machine when deserializing CodeDOM reports.

See Reporting Security for more information on security considerations related to storing and distributing DevExpress reports.

The following code illustrates the recommended approach to loading reports:

// A path to a report's definition file.
string reportFilePath = @"C:\Temp\Report1.repx";

// A path to a report style sheet.
string styleSheetFilePath = @"C:\Temp\ReportStyleSheet1.repss";

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

    // Load a report's layout from XML.
    if (System.IO.File.Exists(reportFilePath)) {
    else {
        System.Console.WriteLine("The source file does not exist.");

    // Load a report's style sheet from XML.
    if (System.IO.File.Exists(styleSheetFilePath)) {
    else {
        System.Console.WriteLine("The source file does not exist.");


See the following topics to learn about the supported serialization formats:

Ensure Safe Loading of Reports

The latest WinForms and WPF End-User Report Designers display a warning when attempting to load a potentially harmful report:


A report is considered harmful on finding any of the following content in it (or in any of its subreports):


The contents listed above expose a client application to the risk of executing arbitrary code injected into a report’s definition when these reports are opened on the client.

Review the following topic for information on security issues related to report storage and distribution: Reporting Security.

See the following documents to find out how to prevent end-users from loading these reports (or enable loading them silently instead):

See Also