This project has moved and is read-only. For the latest updates, please go here.

Conditional format color for Less Than

May 22, 2013 at 6:14 PM
Hi. I'm trying to set a color for a less than conditional format. Here's the format code:
var condition = sheet.ConditionalFormatting.AddLessThan(addr);
condition.Formula = "50";
By default, this doesn't set the conditional format with any color, so you can't see it. I know the condition itself is working, since I can add something like italics and that shows up.

The issue is that unlike the other conditions, there is no condition.Color for Less Than that I can find. Instead you have to set Style.Font.Color, and that doesn't take a Color object to set it. It takes some kind of ExcelDxf object that I'm really not clear on how to use.

Any advice on how to do this? Also, why is this one inconsistent from the ones like Two Color Scale, which just takes a Color object?

May 22, 2013 at 7:48 PM
Nevermind, figured it out. :) You can set condition.Style.Font.Color.Color to a System.Drawing.Color object.

Not sure how I missed that, sorry for the silly question. :)