A newer version of this page is available. Switch to the current version.

ReportPrintTool Class

An instrument for publishing reports in WinForms applications.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraPrinting.v19.2.dll

Declaration

public class ReportPrintTool :
    PrintTool,
    IReportPrintTool,
    IDisposable
Public Class ReportPrintTool
    Inherits PrintTool
    Implements IReportPrintTool,
               IDisposable

Remarks

Use the ReportPrintTool class, to show a report document in a Print Preview form, or immediately send a report to a printer.

In addition to the properties inherited from its base, the PrintTool class, the ReportPrintTool class exposes the ReportPrintTool.Report property that is set to the report you pass as a constructor parameter.

TIP

Use the CachedReportSource object to print reports that include a huge amount of data. This component allows you to avoid memory consumption-related issues by storing pages in a file system or database during document generation. Assign the report to be printed to a CachedReportSource object and pass this object to the Report Print Tool as a constructor parameter. For details, refer to the Printing a Report and Invoking a Default Print Preview Form topics.

NOTE

This class is supposed to be used only in WinForms applications. To publish reports in an ASP.NET application, use the Document Viewer control.

Examples

This example illustrates how to define a document scale factor in a print preview.

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

private void button1_Click(object sender, EventArgs e) {
    ReportPrintTool printTool = new ReportPrintTool(new XtraReport1());
    printTool.Report.CreateDocument(false);
    printTool.PreviewForm.Load += new EventHandler(PreviewForm_Load);
    printTool.ShowPreviewDialog();
}

void PreviewForm_Load(object sender, EventArgs e) {
    PrintPreviewFormEx frm = (PrintPreviewFormEx)sender;
    frm.PrintingSystem.ExecCommand(PrintingSystemCommand.Scale, new object[] { 0.7f });
}

Inheritance

See Also