[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Selection
   [Expand]Filtering and Searching
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus and Navigation
   [Expand]Conditional Formatting
   [Expand]Drag-and-Drop
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Collapse]Printing and Exporting
     Printing
     Printing Options
     Exporting
     Customizing the Appearance of Data Cells when Printing or Exporting the Grid
     Grid-Based Report Generation
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[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)

Customizing the Appearance of Data Cells when Printing or Exporting the Grid

When printing a grid, the appearance of its data cells is defined by the DisplayTemplate specified in a cell's printing style. To customize a cell's printing appearance, create a new control template for a cell and assign it to DisplayTemplate within a custom printing cell style.

The following example shows how to render images within data cells to which a PopupImageEdit is assigned.

All controls used in a template must be adjusted for printing. Controls inherited from BaseEdit, must have the BaseEdit.IsPrintingMode property set to true.

Other controls must be adjusted for printing via the ExportSettings attached property. Specify the ExportSettings.TargetType property. This property is defined in the "xmlns:dxp="http://schemas.devexpress.com/winfx/2008/xaml/printing" namespace and specifies how a control should be treated by the DevExpress Printing Subsystem.

To print a standard TextBlock within a cell, set the ExportSettings.TargetType property to Text. To specify a control's background and foreground, use the ExportSettings.Background and ExportSettings.Foreground properties respectively.

Note

A new cell printing style must be based on the predefined DefaultPrintCellStyle. The TargetType property must be set to the type of an editor used in the column to which this style will be applied.

Note

The ColumnBase.CellTemplate property value does not affect printed/exported cells' appearance.

Expanded Example: Customizing the Printing Appearance of a Cell

This example shows how to create custom PrintCellStyle for grid columns to bring a custom printing appearance for PopupImageEdit, CheckBoxEdit and MemoEdit.

To learn more on how to implement similar functionality in Silverlight, refer to the T245823 example.

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