[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Collapse]Reporting
 [Expand]Product Information
 [Expand]Get Started with DevExpress Reporting
 [Expand]Create Popular Reports
 [Expand]Detailed Guide to DevExpress Reporting
 [Expand]Visual Studio Report Designer
 [Collapse]Create End-User Reporting Applications
   Cross-Platform Reporting
  [Collapse]WinForms Reporting
   [Collapse]Print API
     Print a Report
     Print Multiple Reports in a Batch
     Specify Print Settings
     Specify the Number of Copies to Print
     Manage the Print Progress
     Print a Specified Range of Report Pages
     Specify the Paper Source and Printer Resolution
     Obtain the Current Page Number when Printing a Control
   [Expand]Print Preview
   [Expand]End-User Report Designer
   [Expand]Application Security
   [Expand]Application Appearance
    Application Deployment
   [Expand]Localization
    End-User Documentation
  [Expand]WPF Reporting
  [Expand]Web Reporting
  [Expand]WCF Report Service
  [Expand]Discontinued Platforms
   Localization
   Redistribution and Deployment
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Print a Report

This topic describes how to print a report in a WinForms application.

Expanded Essential Methods

Create the ReportPrintTool class' instance and use any of the following methods to print a report:

  • The PrintToolBase.Print method sends a document to a printer (the system's default or a specific printer) using default printing settings.

    Note

    An exception is thrown when a printer with the specified name is not found.

    In Print Preview, this method corresponds to the Quick Print command.

  • The PrintTool.PrintDialog method raises the Print dialog, where an end-user can select a printer and specify other print options before printing the document:

    In Print Preview, this method corresponds to the Print command.

Expanded Print Light-Weight Reports

Pass the report's instance to the ReportPrintTool object' constructor as a parameter. Use one of the ReportPrintTool's methods detailed above to print the associated report.

The following code illustrates how to use these methods to print a report in a Windows Forms application:

Tip

Calling any of these methods generates a report document by calling the XtraReport.CreateDocument method internally if the document is not created yet.

Expanded Print Large Reports

Use the CachedReportSource component 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.

Create a CachedReportSource instance specifying a report to be printed and a storage to cache the report document.

The MemoryDocumentStorage object used in this code stores a document in memory in a compact way. You can use the FileDocumentStorage, DbDocumentStorage or implement a custom (see DocumentStorage) storage instead.

Pass a CachedReportSource instance to the ReportPrintTool object' constructor as a parameter. Use one of the ReportPrintTool's methods detailed above to print the report associated with the CachedReportSource object.

Tip

Calling any of the printing methods generates a report document by calling the CachedReportSource.CreateDocumentAsync method internally if the document is not created yet.

Is this topic helpful?​​​​​​​