I need to set the Fill Color (Background) of the Excel Cell to Red or Green based on some threshold value.
I have used Style.Fill.BackgroundColor
and Style.Font.FontColor
property conditionally to fill the background color and font color but then found out that the NumberFormat
can also be used to set the font color conditionally like this:
Style.NumberFormat.Format = "[Red][<=100];[Blue][>100]";
Is there any way I can set the fill color by using the NumberFormat
property of the cells so that I can leave checking the condition on MS Excel itself?