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).
n 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(); SaveFileDialog dialog = new SaveFileDialog();
dialog.DefaultExt = "*.xls";
dialog.Filter = "Files(*.xls)|*.xls";
if (!(bool)dialog.ShowDialog())
return;
radChart.ExportToExcelML(dialog.FileName);
fileStream.Close();The snapshot below shows the exported ExcelML file loaded into Excel.
