XtraReport.SaveLayout(String) Method

Saves the report’s definition (layout and configuration) to a file in the REPX format.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v21.1.dll

Declaration

public void SaveLayout(
    string fileName
)

Parameters

Name Type Description
fileName String

A String containing the full path (including the file name) specifying where 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.FromFile 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.

Example

This example demonstrates how to save a report definition to a REPX file (by using the XtraReport.SaveLayout method) and how to load this definition (by using the XtraReport.LoadLayout method).

using DevExpress.XtraReports.UI;
using System.Windows.Forms;
// ...

// A temporary path to save a report to.
string filePath = @"C:\Temp\XtraReport1.repx";

private void button1_Click(object sender, System.EventArgs e) {
    // Create a report.
    XtraReport1 report = new XtraReport1();

    // Save a report's layout to the configuration file.
    report.SaveLayout(filePath);
}

private void button2_Click(object sender, System.EventArgs e) {
    // Create a report.
    XtraReport1 report = new XtraReport1();

    // Load a report's layout from the specified file.
    report.LoadLayout(filePath);

    // Display the print preview.
    ReportPrintTool pt = new ReportPrintTool(report);
    pt.ShowPreviewDialog();
}
See Also