New to Telerik UI for WPF? Download free 30-day trial

Chart Export

RadChart allows you to export the chart in several file formats:

  • Png - Portable Netwok Graphic. Use RadChart.ExportToImage(Stream).

  • Bmp - Bitmap file. Use RadChart.ExportToImage(Stream, BitmapEncoder) where the encoder is of type BmpBitmapEncoder().

  • ExcelML - ExcelML file, supported by Office 2003 and above. Use RadChart.ExportToExcelML(Stream).

  • Xps - XML Paper Specification file. Use RadChart.ExportToXps(Stream).

In WPF there are overloads for the methods listed above, which take as parameter the name of the file you want to export to, instead of a stream. This allows you to easily export your chart directly to a file.

The following example demonstrates how to export RadChart to ExcelML file format.

SaveFileDialog dialog = new SaveFileDialog(); 
dialog.DefaultExt = ".xls"; 
dialog.Filter = "Files(.xls)|.xls"; 
if ( !( bool )dialog.ShowDialog() ) 
    return; 
Stream fileStream = dialog.OpenFile(); 
radChart.ExportToExcelML( fileStream ); 
fileStream.Close(); 
Dim dialog As New SaveFileDialog() 
dialog.DefaultExt = ".xls" 
dialog.Filter = "Files(.xls)|.xls" 
If Not CBool(dialog.ShowDialog()) Then 
    Return 
End If 
Dim fileStream As Stream = dialog.OpenFile() 
radChart.ExportToExcelML(fileStream) 
fileStream.Close() 

SaveFileDialog dialog = new SaveFileDialog(); 
dialog.DefaultExt = ".xls"; 
dialog.Filter = "Files(.xls)|.xls"; 
if (!(bool)dialog.ShowDialog()) 
    return; 
radChart.ExportToExcelML(dialog.FileName); 
fileStream.Close(); 
Dim dialog As New SaveFileDialog() 
dialog.DefaultExt = ".xls" 
dialog.Filter = "Files(.xls)|.xls" 
If Not CBool(dialog.ShowDialog()) Then 
    Return 
End If 
radChart.ExportToExcelML(dialog.FileName) 
fileStream.Close() 

The snapshot below shows the exported ExcelML file loaded into Excel.

WPF RadChart Exported ExcelML File in Excel

See Also

In this article