How to: Export a Chart to XLS

The following example demonstrates how to export a chart image inserted into XLS document to either a file or a stream.

using System.IO;
// ...

if (chartControl1.IsPrintingAvailable){
    // Exports to an XLS file.
    chartControl1.ExportToXls("Output.xls");

    // Exports to a stream as XLS.
    FileStream xlsStream = new FileStream("Output.xls", FileMode.Create);
    chartControl1.ExportToXls(xlsStream);
    // ...

    xlsStream.Close();
}