XtraReport.SaveLayout(Stream) Method

Saves the report's definition (layout and configuration) to a Stream object in the REPX data format.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

public void SaveLayout(
    Stream stream
)
Public Sub SaveLayout(
    stream As Stream
)

Parameters

Type Name Description
Stream stream

A Stream object to which the report's definition will be saved.

A report definition contains all report settings, as well as settings of report controls. To load the report's definition from a REPX file, use the XtraReport.LoadLayout and XtraReport.FromStream methods.

Alternatively, to save a report definition in an XML format, use the XtraReport.SaveLayoutToXml.

To learn more, see Storing Report Layouts.

Examples

This example demonstrates how to save a report definition to a stream (assigned to a corresponding ASP.NET Session) as a REPX file and restored back by using the XtraReport.SaveLayout and XtraReport.FromStream methods.

using System.IO;
using DevExpress.XtraReports.UI;
// ...

private void StoreReport(XtraReport report) {
   // Create a stream.
   MemoryStream stream = new MemoryStream();

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

   // Save the stream to a session.
   Session["report_stream"] = stream;
}

private XtraReport RestoreReport() {
   // Restore the stream from the session.
   MemoryStream stream = (MemoryStream)Session["report_stream"];

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

See Also