Skip to main content

XtraReport.FromXmlFile(String, Boolean) Method

Loads the serialized report definition from the specified XML file.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v23.1.dll

NuGet Package: DevExpress.Reporting.Core


public static XtraReport FromXmlFile(
    string path,
    bool loadState = true


Name Type Description
path String

The full path (including the file name and extension) to the XML file.

Optional Parameters

Name Type Default Description
loadState Boolean True

true to restore the report’s property values along with the settings applied to its elements (bands and controls); false to load only the report’s base type settings.


Type Description

An XtraReport class (or its descendant, the type of which is specified in the XML file).


Use the FromXmlFile method to restore a report from its definition file stored in serialized XML format.

To be able to restore the report class settings, this method should locate the associated report type based on which the specified report definition file was created. This type is searched for in the following assemblies:

  1. In the current assembly (from which the FromXmlFile method is called);
  2. In the assemblies referenced by the current assembly;
  3. In the loaded assemblies.

When this method fails to locate the original class type, it creates a new XtraReport class instance.

Call this method with its loadState parameter set to true to restore all custom report property values and element property values.


Set loadState to true in most scenarios, because the report specified in the definition file can be of the XtraReport type (for instance, when a report was saved in the Visual Studio report designer). In this case, the false value in the loadState parameter causes the application to generate an empty report.


This example demonstrates how to use the XtraReport.FromXmlFile method to restore a report definition from a file.

In the example, this method is called with its loadState parameter set to true, and restores a report’s custom property values and element property values.

To run the example, the application must successfully locate the assembly based on which the specified XtraReport1.xml file was created (either in the original project folder, among the assembly references, or in the GAC).

using DevExpress.XtraReports.UI;
// ...
private void StoreReport(XtraReport report) {
    // Save a report to the stream. 

private XtraReport RestoreReport() {
    // Create a report from the stream. 
    return XtraReport.FromXmlFile(@"..\\..\\XtraReport1.xml", true);
See Also