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.v21.1.dll


public void SaveLayout(
    Stream stream


Name Type 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.

This method saves a report as a Code Document Object Model (CodeDOM) graph. Alternatively, to save a report definition in an XML format, use the XtraReport.SaveLayoutToXml.

To learn more, see Storing Report Layouts.


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.

   // 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