The requested page is not available for the requested platform. You are viewing the content for Default platform.
All docs
V19.1
19.2 (EAP/Beta)
19.1
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

XtraReport.FromXmlFile(String, Boolean) Method

Loads the serialized report definition from the specified XML file.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.1.dll

Declaration

public static XtraReport FromXmlFile(
    string path,
    bool loadState = true
)
Public Shared Function FromXmlFile(
    path As String,
    loadState As Boolean = True
) As XtraReport

Parameters

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.

Returns

Type Description
XtraReport

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

Remarks

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.

Note

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.

Examples

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. 
    report.SaveLayoutToXml(@"..\\..\\XtraReport1.xml");
}

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