How to: Export a Chart

The Chart Control's client-side representation contains an image that displays the chart and a JavaScript object that allows you to use the chart's client-side API. The client-side ASPxClientWebChart control provides the ASPxClientWebChartControl.SaveToDisk and ASPxClientWebChartControl.SaveToWindow methods. These methods allow you to export the chart to one of the available formats (PDF, XLS, XLSX, MHT, RTF, RTF, PNG, JPEG, BMP, TIFF and GIF).

Note that you cannot use the server-side control's WebChartControl.SaveToFile and WebChartControl.SaveToStream methods on the client-side to save the control's layout.

NOTE

The Chart Control requires the XtraPrinting Library to export the chart to all formats except for images. Your project should contain the DevExpress.XtraPrinting assembly reference to use the print API.

IMPORTANT

The Chart Control sends a post back request to the server to generate a file that contains the export result. You should configure the chart control on the post back request the same as on the initial page load to print the chart correctly. Otherwise, the exported chart differs from the chart on the page.

Refer to the How to export a web chart on the client side topic for an example.