I am working with NPOI. How can I add color scale to a specific cell range excel's spreedsheet using c# and NPOI?
In MS Excel you can do this using Conditional Formatting -> Color scale.
Whilst I highly doubt that the original poster is still searching for this answer six years on, I can offer up the following snippet which I have based off of this Java POI example:
var conditionalFormatting = xssfSheet
.GetCTWorksheet()
.AddNewConditionalFormatting();
conditionalFormatting.sqref = "A1:B10";
var rule = conditionalFormatting.AddNewCfRule();
rule.type = ST_CfType.colorScale;
rule.priority = 1;
var colorScale = rule.AddNewColorScale();
var minValue = colorScale.AddNewCfvo();
minValue.type = ST_CfvoType.min;
minValue.val = "0";
var maxValue=colorScale.AddNewCfvo();
maxValue.type = ST_CfvoType.max;
maxValue.val = "0";
var lowColor = colorScale.AddNewColor();
var highColor = colorScale.AddNewColor();
lowColor.SetRgb(0xFC, 0xFC, 0xFF);
highColor.SetRgb(0xF8, 0x69, 0x6B);