[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].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Collapse]Charts Suite
   [Collapse]Chart Control
    [Expand]Getting Started
    [Expand]Fundamentals
    [Expand]Providing Data
    [Expand]Chart Elements
    [Expand]Appearance Customization
    [Collapse]End-User Features
     [Expand]End-User Capabilities
     [Expand]Tooltip and Crosshair Cursor
      Hit-Testing
      Selection
     [Expand]Animation
      Print and Export
      Chart Designer for End-Users
    [Expand]Design-Time Features
    [Expand]Examples
    [Expand]Additional Resources
   [Expand]Chart3D Control
  [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]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 and Export

The Chart control allows you to print a chart and export it to different file formats using the chart's API, the system's print dialog or the Print Preview form.

This topic describes how to print and export a chart and configure its print options.

Note

You should add a reference to the DevExpress.Xpf.Printing.19.2 assembly to preview, print, and export a chart using the DXPrinting Library.

Expanded Immediately Print a Chart

Call the ChartControlBase.PrintDirect method to use the default printer and page settings to print a chart.

Expanded Show the Default Print Dialog

You can use the ChartControlBase.Print method to change the default print settings before printing.

The code above invokes the standard print dialog. Specify the required settings and click the Print button to print a chart.

Expanded Show the Chart's Print Preview

End users can print/export a chart and customize printing/exporting settings using the Print Preview. The following methods invoke the Print Preview dialog:

The appropriate method Description
ChartControlBase.ShowPrintPreview Creates a document to be printed and invokes the Print Preview with the standard toolbar.
ChartControlBase.ShowPrintPreviewDialog Creates a document to be printed and invokes the Print Preview with the standard toolbar as a modal window.
ChartControlBase.ShowRibbonPrintPreview Creates a document to be printed and invokes the Print Preview with a Ribbon .
ChartControlBase.ShowRibbonPrintPreviewDialog Creates a document to be printed and invokes the Print Preview with a Ribbon as a modal window.

The Print group on the Print Preview's Ribbon contains buttons that allow you to print a chart and configure print settings. To print a chart, click the Print... item.

The Export group on the Print Preview's Ribbon comprises buttons that allow you to export a chart and then save it to a file on the disk or attach the file to an e-mail. To export a chart, click the Export... and select the desired file format.

Note

The images above illustrate the Ribbon Print Preview .

Expanded Export a Chart

You can use API methods to convert a chart to a specific format. The following table lists the file formats and their corresponding export methods:

The exporting format The appropriate method
PDF ChartControlBase.ExportToPdf
HTML ChartControlBase.ExportToHtml
MHT ChartControlBase.ExportToMht
RTF ChartControlBase.ExportToRtf
XLS ChartControlBase.ExportToXls
XLSX ChartControlBase.ExportToXlsx
Image ChartControlBase.ExportToImage
DOCX ChartControlBase.ExportToDocx
Note

You should specify a Chart Control's size using its Width and Height properties when you are exporting a chart that is not added to the Window's Content. Otherwise, the exported document is empty.

Expanded Specify the Chart Print Options

The ChartControlBase.PrintOptions property provides access to the chart's print options. The options specify the printed/exported chart's parameters. Use the ChartPrintOptions.SizeMode property to define how the printed/exported chart should be resized on a page.

The code below demonstrates how to fit the chart's size to the printed page's size.

You can also use a PrintSizeMode value as the ChartControlBase.PrintDirect, ChartControlBase.Print and ExportTo~ (for example, ChartControlBase.ExportToPdf, ChartControlBase.ExportToImage, etc.) method parameter.

Expanded See Also

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