Skip to main content
A newer version of this page is available. .

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
)

Parameters

Name Type Description
stream Stream

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

Remarks

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.

Example

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);
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveLayout(Stream) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also