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.FromXmlStream(Stream, Boolean) Method

Loads the report definition data from the specified stream and creates a report object from it. The created report's class is also specified in the XML data format.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.1.dll

Declaration

public static XtraReport FromXmlStream(
    Stream stream,
    bool loadState = true
)
Public Shared Function FromXmlStream(
    stream As Stream,
    loadState As Boolean = True
) As XtraReport

Parameters

Name Type Description
stream Stream

The Stream object that contains the XML data to load.

Optional Parameters

Name Type Default Description
loadState Boolean True

true, to load the report's state which is also saved in the XML data; otherwise, false.

Returns

Type Description
XtraReport

An XtraReport class or its descendant of the type specified in the XML data.

Remarks

Use the FromXmlStream method to create a report instance from the report definition data stored in the specified stream. To create the report, this method should find the report's class type. The class type name is stored in the XML data header. This type is searched for in the following assemblies:

  1. In the current assembly where the FromXmlStream method is called from;
  2. In the assemblies referenced by the current assembly;
  3. In the loaded assemblies.

If this class type is not found, an instance of the XtraReport class is created.

Set the loadState parameter to true to apply the saved state to the created report instance.

Examples

This example demonstrates how to use the XtraReport.SaveLayoutToXml method to save a report definition to a stream (assigned to a corresponding ASP.NET Session) as an XML file, and how to use the XtraReport.FromXmlStream method to restore the report definition.

using System.IO;
using DevExpress.XtraReports.UI;
// ...
private MemoryStream report_stream;
private void StoreReport(XtraReport report) {
    // Create a stream. 
    MemoryStream stream = new MemoryStream();

    // Save a report to the stream. 
    report.SaveLayoutToXml(stream);

    // Save the stream to a session. 
    this.report_stream = stream;
}

private XtraReport RestoreReport() {
    // Restore the stream from the session. 
    MemoryStream stream = (MemoryStream)this.report_stream;

    // Create a report from the stream. 
    return XtraReport.FromXmlStream(stream, true);
}
See Also