The requested page is not available for the requested platform. You are viewing the content for Default platform.

XtraReport.ExportToRtf(Stream) Method

Exports a report to the specified stream in RTF format.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.1.dll

Declaration

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

Parameters

Name Type Description
stream Stream

A Stream object to which the created RTF file should be sent.

Remarks

Once the document export has started, it will run until the resulting document is complete and cannot be interrupted or canceled in the process.

Use this method to export a report to RTF format using its current RTF-specific export options. These options are represented by the RtfExportOptions object returned by the ExportOptions.Rtf property of a report's XtraReport.ExportOptions.

Note

For more information on using the ExportToRtf method, and limitations on export to RTF, please refer to the Export to RTF document.

Examples

The following example demonstrates how to export a report to RTF format. To do this, the XtraReport.ExportToRtf method should be used.

For this example to work, you first need to add a new report (named XtraReport1) to your project, drop some report controls onto it, and then execute the code below (for instance, in the Button.Click event handler of any button on a form). Note also, that if you want the resulting file to be automatically opened in the default program which is used to open *.rtf files in your system, you can call the StartProcess method, which is also shown in this example.

using System.Diagnostics;
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
// ...

private void ExportToRTF()
{
    // A path to export a report.
    string reportPath = "c:\\Test.rtf";

    // Create a report instance.
    XtraReport1 report = new XtraReport1();

    // Export the report to RTF.
    report.ExportToRtf(reportPath);

    // Show the result.
    StartProcess(reportPath);
}

// Use this method if you want to automaically open
// the created RTF file in the default program.
public void StartProcess(string path)
{
    Process process = new Process();
    try
    {
        process.StartInfo.FileName = path;
        process.Start();
        process.WaitForInputIdle();
    }
    catch { }
}
See Also