Search code examples
c#excelexcel-2007office-automation

Format Excel Chart Background using C#


I can already populate the data into the spreadsheet, create the chart based on the range I select. However, when it comes to formatting the actual chart I feel a bit lost as their are so many options!!

It is an xlCylinderBarStacked type chart. I simply need to make the color of the bars a nice light orange and make the background a light blue fading into white at the bottom.

Any idea's how to do this?


Solution

  • Just to close this question off. I played around a little with the properties and the following achieved the gradient effect on the background of the chart.

    xlChart.Interior.Color = ColorTranslator.ToOle(Color.LightSkyBlue);
    chart.ChartArea.Fill.TwoColorGradient(
           Microsoft.Office.Core.MsoGradientStyle.msoGradientHorizontal, 
           1);