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]Data Binding
   [Expand]Views
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Filter and Search
   [Expand]Summaries
   [Expand]Focus and Selection Handling
    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
    Split Presentation
    Row Preview Sections
    Scrolling
   [Expand]Batch Modifications
   [Expand]Hit Information
    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]ASP.NET Core 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]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Printing Overview

The Grid Control provides methods for printing displayed data, showing a preview window and invoking a print dialog. This topic demonstrates how to customize the printed version of the Grid Control, and lists ways with which the grid control can be printed. This topic consists of the following subsections.

Note

Custom painting, alpha blending and color gradient features are not supported in the grid control's printout.

Note

In Large Data Sources: Server and Instant Feedback Modes, a print/export document is not regenerated each time it is sent to the print/export output. This means that if a print/export document has been generated and it's not empty, subsequent changes to the grid's layout (changing filter, sort and group settings, modifying cell values, etc.) are not applied when you send the grid's data to the print/export output the next time. To apply the changes made, call the BaseView.CreateDocument method before sending the grid's data to the print/export output.

Expanded Printing Basics

Although the Grid Control provides direct methods for printing displayed data, these methods delegate the printing functionality to the DevExpress Printing Library. If this library cannot be found, the printing and export functionality is not available. To ensure that Grid Control printing/exporting is permitted, check the GridControl.IsPrintingAvailable property's value.

To print data from the Grid Control, use the following methods.

Member Description
GridControl.Print Prints the grid control's DefaultView (the MainView or the currently maximized detail View) without showing a print preview or print dialog.
GridControl.PrintDialog Displays the standard Print dialog to print the data displayed in the Grid Control's DefaultView.
GridControl.ShowPrintPreview Opens the Print Preview window with a Bars UI.
GridControl.ShowRibbonPrintPreview Displays the Print Preview window with a Ribbon UI.

These methods print and show a print preview of the data displayed by the Grid Control's Default View (the GridControl.MainView or the currently maximized detail View).

A detail View can be printed as follows:

The following example shows how to preview grid data.

The image below illustrates the Preview window for a sample grid.

Refer to the XtraPrinting Library documentation for more information on the functionality provided by the print preview window.

To customize general print/export settings (e.g., page orientation and margins), handle the BaseView.PrintInitialize event.

Expanded Modifying Print Appearances

By default, a printed grid utilizes the same appearances as when it is displayed onscreen (these appearance settings can be customized for each View using the BaseView.Appearance property). However, each View provides print appearances used to paint the View's visual elements (buttons, headers, cells, etc.) in print output. To use print appearances instead of display appearances when the grid is printed, set the View's OptionsPrint.UsePrintStyles option to true.

Use the View's BaseView.AppearancePrint object to adjust print appearances. This object provides multiple properties with which you can specify the appearance settings for various View elements (for Grid Views - data and group rows, even and odd data rows, filter panel, footer panel, etc.; for Card Views - card caption, field value, etc.). The following image illustrates the print appearances for a Grid View in the Properties window.

The code below shows how to enable print appearances and customize the background color of even rows.

The result is displayed in the image below.

The printing appearances can also be customized in the Print Appearances Page of the Grid Designer.

Expanded Printing Options

Each View provides a set of options that specify the View elements to be printed, as well as the appearance settings to be used to paint these elements when the grid control is printed. These options can be accessed as follows.

Expanded See Also

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