Skip to main content

XtraReport.SaveDocument(Stream, NativeFormatOptions) Method

Saves the report document to the specified stream in the XML-based PRNX format.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public void SaveDocument(
    Stream stream,
    NativeFormatOptions options = null
)

Parameters

Name Type Description
stream Stream

The stream to save the report document to.

Optional Parameters

Name Type Default Description
options NativeFormatOptions null

PRNX options to apply to the saved document. You can omit this parameter or set it to null (Nothing in Visual Basic) to use the ExportOptions.NativeFormat settings.

Remarks

If a document has not been generated for the report, the report’s CreateDocument() method is called before the document is saved.

The code sample below shows how to save a report to a stream.

using DevExpress.XtraReports.UI;
using System;
using System.IO;
// ...
// Create a simple report.
XtraReport report = new XtraReport()
{
    Name = "SimpleReport",
    Bands = {
        new DetailBand() {
            Controls = {
                new XRLabel() {
                    Text = "Simple Report"
                }
            }
        }
    }
};
// Create the report document file in the user's Downloads folder.
FileStream stream = File.Open(
    Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\Downloads\" + report.Name + ".prnx",
    FileMode.Create);
// Save the report to the created file.
report.SaveDocument(stream);
See Also