I have been trying to figure this one out for a while, but can't seem to get anywhere. I am simply trying to change the color of the last column in an Excel column chart (e.g. first 3 columns blue, last column orange) using C#. I have scoured many forums and Interop class definitions to no avail.
Here is the code:
Microsoft.Office.Interop.Excel.Series series1 = (Series)xlChart.SeriesCollection(2);
series1.Interior.Color = newColorList[0];
Microsoft.Office.Interop.Excel.Point point1 = (Point)series1.Points(4); //this line throws an exception
point1.Interior.Color = newColorList[7];
The third line throws an "Invalid Parameter" exception, and despite my searches I cannot figure out how to fix it. Any help is appreciated, especially if I should go a different route to change the color of that last column.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire