Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Summaries
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Collapse]Export and Printing
     Printing Overview
     Member Table: Printing
     Export Overview
     Export Methods and Settings
     Export to XLS and XLSX Formats
     Advanced Grid Printing and Exporting
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Advanced Grid Printing and Exporting

The report generation feature provides an advanced way to print and export your WinForms Grid Control data. You can easily generate a report from the grid data either at design time or at runtime, taking into account the grid layout. During report generation, it is possible to specify print appearance settings and control which grid elements are added to the report.

You can then modify the generated report as required, delegate report customization to an end-user, send the report to a printer or export it to various formats, and allow the end-user to do this manually.

Note

The report generation feature is supported for the following GridControl Views: GridView, BandedGridView and AdvBandedGridView.

The following sections provide details on how to generate and use grid reports.

Expanded Supported Grid Features

The report generation engine takes into account the following grid features and settings.

Expanded Limitations

The following features are not supported by the report generation engine.

Expanded Generating a Report at Design Time

To generate a report based on GridControl's data at design time, do the following.

  1. Locate the ReportGenerator component in the Toolbox and drag-and-drop it onto the application form.

  2. Click the ReportGenerator's smart tag and select Generate Report.

  3. On the first page of the invoked Report Wizard, select the GridControl's View for which the report is to be generated and click Next.
    Note

    Currently, reports can only be generated for GridViews, BandedGridViews and AdvBandedGridViews.

  4. The next wizard page allows you to select the grid elements to be included in the report.
    • Print Column Headers - Specifies whether to add column headers to the report.
    • Print Total Summary Footer - Specifies whether to add the summary footer to the report.

    The preview pane immediately reflects the changes made to the options. Click Next.

  5. This wizard page allows you to specify data grouping-specific settings.
    • Print Group Rows - Specifies whether to include group rows in the report.
    • Print Group Summary Footer - Specifies whether to add group footers to the report.

  6. In the Styles wizard page, choose whether dedicated print styles or default styles should be used when generating a report. The preview shows how these options change the report's appearance.
    • Use Print Appearances - Specifies whether dedicated print appearance settings (GridView.AppearancePrint) or regular appearance settings (GridView.Appearance) are used when generating a report.
    • Enable Even Row Print Appearance - Specifies whether even rows in the resulting report are painted using the appearance settings provided by the GridViewPrintAppearances.EvenRow property. This option is in effect if the Use Print Appearances setting is enabled.
    • Enable Odd Row Print Appearance - Specifies whether odd rows in the resulting report are painted using the appearance settings provided by the GridViewPrintAppearances.OddRow property. This option is in effect if the Use Print Appearances setting is enabled.
    • Print Vertical Lines - Specifies the visibility of vertical grid lines in the report.
    • Print Horizontal Lines - Specifies the visibility of horizontal grid lines in the report.

  7. In the next page, specify the title for the generated report and click Finish to complete the wizard.

Expanded Scenarios of Using the Generated Report

The generated report is automatically added to the current project under the specified name and opened in the advanced Report Designer, which is fully integrated into the Visual Studio IDE. The report's declaration can be found in the file with the same name as the report name.

The report designer provides rich creating, editing and publishing capabilities including the following.

  • Print, Print Preview, and Export actions
  • Modifying report element layouts
  • Modifying report element appearances
  • Applying data grouping, sorting and filtering
  • Adding totals
  • Adding page numbers and system information
  • etc.

See the Report Designer document for more information about report design-time customization.

After the report is generated and customized, you can show the report's print preview to your end-users. To learn how to accomplish this, see the How to: Invoke a Report's Print Preview and How to: Add a Print Preview to a Windows Forms Application topics.

It is possible to delegate report customization to end-users. They can use the End-User Report Designer to manually modify the report, show a Print Preview, export the report, etc. For more information, refer to the End-User Report Designer document.

The following code creates a new instance of the generated report class and opens it in the End-User Report Designer.

Expanded Generating a Report in Code

At runtime, a report can be generated using the ReportGenerator.GenerateReport static method of the ReportGenerator class.

When generating a report in code, you can also take into account dedicated report generation options (those that are available in the Report Generation Wizard). To do this, create a ReportGenerationOptions class instance, set its appropriate properties and pass it as the last parameter to the GenerateReport method.

How would you rate this topic?​​​​​​​