poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edkalel <eduardo...@gmail.com>
Subject Set background color in a conditional formatting cell
Date Fri, 31 Oct 2014 16:54:51 GMT
Hi poi users,

I'm trying to set a background color in a cell with conditional formatting,
but the problem is that the color passed to setFillBackgroundColor method is
different from the background color cell that appears in the excel file.
Here is my code:

SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();
ConditionalFormattingRule rule1 =
sheetCF.createConditionalFormattingRule(ComparisonOperator.GT, "0");

PatternFormatting fill1 = rule1.createPatternFormatting();
fill1.setFillBackgroundColor(IndexedColors.RED.index);
fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND);

ConditionalFormattingRule [] cfRules = { rule1 };
CellRangeAddress[] regions = { CellRangeAddress.valueOf("H4:J7") };
sheetCF.addConditionalFormatting(regions, cfRules);



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Set-background-color-in-a-conditional-formatting-cell-tp5716990.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message