There is a chart:

enter image description here

I want to programmatically change the color of the first column to green, so that the result will be:

enter image description here

I tried different ways:

ChartObject chartObject = sheet.ChartObjects(@"Диаграмма1"); Excel.Series ser = (Excel.Series)chartObject.Chart.SeriesCollection(1); ser.Format.Line.ForeColor.RGB = (int)Excel.XlRgbColor.rgbGreen; ser.Format.Line.BackColor.RGB = (int)Excel.XlRgbColor.rgbGreen; ser.Format.Shadow.ForeColor.RGB = (int)Excel.XlRgbColor.rgbGreen; ser.Format.Fill.BackColor.RGB = (int)Excel.XlRgbColor.rgbGreen; 

enter image description here

But, as you can see, I can only change the color of the contour. What to do?

    2 answers 2

    Try this:

     ser.Border.Color = ColorTranslator.ToOle(chartColor); 
    • I tried ser.Border.Color = ColorTranslator.ToOle(Color.Red); gives the same thing - colors the outline in red. - Adam

    The correct answer was:

     series.Points(1).Interior.Color = (int)XlRgbColor.rgbRed;