Skip to main content

Printing and Exporting

  • 2 minutes to read

The DevExpress Silverlight DXGrid supports client-side printing and server-side exporting. Key features include:

  • Complete customization of grid rows and cells in a printed document via templates and styles
  • Advanced Print Preview control

    DXGrid-PrintPreview

  • Supported Export Formats: PDF, Excel, RTF, XPS, Text, CSV, MHT, HTML, Image (PNG, BMP, etc.)

Requirements:

  • DevExpress.Xpf.Printing.vX.X assembly

#Printing Options

A view provides multiple options, styles and templates, that allow you to customize a printed document.

The following table lists printing options:

Property Description
TableView.PrintAllGroups Specifies whether the grid is printed with all group rows expanded or not.
TableView.PrintAutoWidth Specifies whether printed column widths are automatically changed or not, so that the grid fits the width of the report page.
TableView.PrintColumnHeaders Specifies whether column headers are printed or not.
TableView.PrintTotalSummary Specifies whether the Summary Panel is printed or not.

The following table lists the styles and templates applied to grid elements when a view is printed.

Property

Description

ColumnBase.PrintCellStyle

TableView.PrintCellStyle

Specifies a style applied to column cells when a grid is printed.

ColumnBase.PrintColumnHeaderStyle

TableView.PrintColumnHeaderStyle

Specifies a style applied to column headers when a grid is printed.

TableView.PrintGroupRowStyle

Specifies a style applied to group rows when a grid is printed.

ColumnBase.PrintTotalSummaryStyle

TableView.PrintTotalSummaryStyle

Specifies the style applied to total summary items when the grid is printed.

TableView.PrintFooterTemplate

Specifies a template that defines the Summary Panel's presentation when a grid is printed.

TableView.PrintGroupRowTemplate

Specifies a template that defines the presentation of group rows when a grid is printed.

TableView.PrintHeaderTemplate

Specifies a template that defines the presentation of column headers when a grid is printed.

TableView.PrintRowTemplate

Specifies thae template that defines the presentation of data rows when a grid is printed.

The following table lists the Master-Detail specific printing options.

Property

Description

TableView.AllowPrintDetails

Specifies whether View's details are printed.

TableView.AllowPrintEmptyDetails

Specifies whether View's details that doesn't contain any data are printed.

TableView.PrintDetailTopIndent

TableView.PrintDetailBottomIndent

Specifies the indents separating the details.

#Data Export

To allow end-users to export a grid, do the following:

  • Add an export service for passing an exported grid to a Silverlight client.

    addexportservice

    addexportservice-1

  • Specify an export link's ServiceUri property.

#Master-Detail Printing

The DXGrid supports printing and exporting master-detail data, allowing to control the manner in which detail rows are printed.

master-detail-printing

#Example: How to Preview the DXGrid Before It Is Printed