Conditional Formatting Using NPOI

Aug 21, 2014 at 2:11 PM
Edited Aug 22, 2014 at 7:01 AM
I have been trying to Format the cells with Different backgroundcolor which meet certain condition . I have made few attempts , it would be helpful there is a sample code.
            ISheetConditionalFormatting ConditionalFormatting = sht.SheetConditionalFormatting;
            IConditionalFormattingRule LessThan90 = ConditionalFormatting.CreateConditionalFormattingRule(
            IConditionalFormattingRule GreaterThan90 = ConditionalFormatting.CreateConditionalFormattingRule(
            ComparisonOperator.GreaterThanOrEqual, "100.0",null);
            IConditionalFormattingRule Between90and100 = ConditionalFormatting.CreateConditionalFormattingRule(

            IConditionalFormattingRule[] rules = { GreaterThan90, LessThan90, Between90and100 };

            IPatternFormatting pfRed = LessThan90.CreatePatternFormatting();
            pfRed.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.Red.Index;

            IPatternFormatting pfGreen = GreaterThan90.CreatePatternFormatting();
            pfGreen.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.Green.Index;

            IPatternFormatting pfOrange = Between90and100.CreatePatternFormatting();
            pfGreen.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.LightOrange.Index;

            CellRangeAddress[] regions = {
                                             new CellRangeAddress(1,5,9,11)

            ConditionalFormatting.AddConditionalFormatting(regions, rules);
the values in cell ranges from -100 to +300 but it always shows orange for all values and red color for blanks ones
i want to cell level change in back ground not row level or table level change background

Help please !!!!!!!!!!!

Thanks in advance