I want to copy a chart from Excel.
var chart = (ChartObject)allCharts.Item("SomeChart");
chart.Select();
chart.Copy();
The problem is, for some chart types copying failes with Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))
:
As I am not sure, whether this is a full list, I want to somehow check the chart object before copying it.
So far, I found out two clues:
There is a _Chart.Type
, which is "Reserved for internal use." as Microsoft states. The Type gets a value of -1
for the objects above and some other values otherwise.
_Chart.ChartType
Enum seems not to include the objects above and returns an int
value and no names like XlChartType.xlPieExploded
.
The question is, can I rely on any of these two peculiarities or is there another way to prevent copy failure?
User contributions licensed under CC BY-SA 3.0