-3

I'm working on creating an Excel Chart from my C# application that pulls data out of my SQL Server database, and using that data, creates some Charts in an Excel instance. I have a pie chart that displays with the data, and all is well, accept I want to change the background color of the ChartArea and maybe use a gradient to add a little visual variation. I'm having trouble figuring out how do do that in C# using OLE. It looks like Office 16 is installed. This should be simple, but I'm having trouble with this. I saw a chart.ChartArea.Fill.BackColor property, but it's read only (I can't set it). Not sure how to do this programmatically. Any ideas would be helpful. Thanks.

mdmenard
  • 183
  • 1
  • 1
  • 9

1 Answers1

0

I was able to find an answer after more searching. It was the ForeColor property that I wanted after all. The following line of code worked:

myChart.ChartArea.Format.Fill.ForeColor.RGB = ColorTranslator.ToOle(Color.SomeColor);
mdmenard
  • 183
  • 1
  • 1
  • 9