Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[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
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Collapse]Charts Suite
   [Collapse]Chart Control
    [Expand]Getting Started
    [Expand]Fundamentals
    [Expand]Providing Data
    [Expand]Appearance Customization
    [Collapse]End-User Features
     [Expand]End-User Capabilities
     [Expand]Crosshair Cursor
      Tooltips
      Hit-Testing
      Selection
     [Expand]Animation
      Printing and Exporting
      Chart Designer for End-Users
    [Expand]Design-Time Features
    [Expand]Visual Elements
    [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]Diagram Control
  [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]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 and Exporting

The Chart control provides the capability to print a chart and export it to numerous file formats.

This topic allows you to learn how to print, export a chart and configure its print options.

Note

The chart can be previewed, printed and exported only if the DXPrinting Library is available. Make sure you add a reference to the DevExpress.Xpf.Printing.17.2 assembly.

Expanded Immediately Print a Chart

To print a chart using the system default printer and the predetermined page settings, use the ChartControlBase.PrintDirect method.

Expanded Show the Default Print Dialog

If you need to change the default print settings before printing, use the ChartControlBase.Print method.

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

Expanded Show the Chart Print Preview

If necessary, show the chart preview before its printing/exporting. For this, use the following methods to invoke the Print Preview dialog.

The appropriate method Description
ChartControlBase.ShowPrintPreviewCreates a print document and displays the Print Preview of the document.
ChartControlBase.ShowPrintPreviewDialogCreates a print document and displays the Print Preview of the document as a model window.
ChartControlBase.ShowRibbonPrintPreviewCreates a print document and displays the Print Preview with the Ribbon toolbar of the document.
ChartControlBase.ShowRibbonPrintPreviewDialogCreates a print document and displays the Print Preview with the Ribbon toolbar of the document as a model window.

The chart printing capabilities are accessed in the Print group on the Print Preview's Ribbon. To print a chart, click the Print... item.

The chart exporting capabilities are accessed in the Export group on the Print Preview's Ribbon. To export a chart, click the Export... and select the desired file format.

Note

Note that the Ribbon Print Preview is used to describe the chart printing/exporting options.

Expanded Export a Chart

To convert a chart to the desired format from code, use the appropriate API method. The following table contains file formats and the corresponding methods for exporting.

The exporting format The appropriate method
PDF Use the ChartControlBase.ExportToPdf method to export a chart to the PDF format.
HTML Use the ChartControlBase.ExportToHtml method to export a chart to the HTML format.
MHT Use the ChartControlBase.ExportToMht method to export a chart to the MHT format.
RTF Use the ChartControlBase.ExportToRtf method to export a chart to the RTF format.
XLS Use the ChartControlBase.ExportToXls method to export a chart to the XLS format.
XLSX Use the ChartControlBase.ExportToXlsx method to export a chart to the XLSX format.
Image Use the ChartControlBase.ExportToImage method to export a chart to an image.
DOCX Use the ChartControlBase.ExportToDocx method to export a chart to the DOCX format.

Expanded Specify the Chart Print Options

The ChartControlBase.PrintOptions property provides access to the chart print options, specifying parameters of the printed/exported chart. Use the ChartPrintOptions.SizeMode property to set the mode that defines how to resize the printed/exported chart on a page.

The code below demonstrates how to fit the chart size to the size of a page on which the chart is printed.

Alternatively, you can use a PrintSizeMode value as the ChartControlBase.PrintDirect, ChartControlBase.Print and ExportTo~ (e.g., ChartControlBase.ExportToPdf, ChartControlBase.ExportToImage, etc.) method parameter.

Expanded See Also

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