How to get the image of a Chart control? RRS feed

  • Question

  • hello,everyone.

    I have a form application  which has a Chart control on it.  Now I would like to get the image of the Chart control and insert the image into a Excel. Here is my simple code:

    _appExcel = new Microsoft.Office.Interop.Excel.ApplicationClass();
    Microsoft.Office.Interop.Excel.Range range = null;
    range = _appExcel.Range[_appExcel.Cells[4, "H"], _appExcel.Cells[10, "H"]];
    range.MergeCells = true;
     range.Value = chartStart.BackImage; //chartStart is a Chart control

    But the Properties of the Chart control  related to image are all null or empty. They are Chart.Images(Count = 0), Chart.BackImage(return a empty string), Chart.BackgroudImage(it's null).  Why?

    Do I have to call SaveImage() to save a image to local disk, then read it back? It must be some other way?

    • Edited by waterharbin Sunday, November 8, 2015 11:55 AM
    Sunday, November 8, 2015 11:42 AM