ReportPrintTool Class
An instrument for publishing reports in WinForms applications.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraPrinting.v18.1.dll
Declaration
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.
Example
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 });
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ReportPrintTool class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.