Quantcast
Channel: Java Programming Forum - Learn Java Programming - Apache POI
Viewing all articles
Browse latest Browse all 120

Conditional Formatting

$
0
0
In previous version of POI, it is noted that ConditionalFormattingRule containing formulas containing cell references are not parsed properly.

I installed version 3.10 and it appears to behave the same way as before. Cell references are not updated for a range of cells.

Is there workaround or other method that should be used to apply ConditionalFormattingRule?

When using the code below, on row 3, the reference is still A2 instead of being recalculate.

Example:
SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();

ConditionalFormattingRule rule = sheetCF.createConditionalFormattingRule( "AND($A2=\"\",OR($B2=\"PPA\",$B2=\"PAX\"))");

PatternFormatting ruleFmt= rule.createPatternFormatting();
ruleFmt.setFillBackgroundColor(IndexedColors.RED.i ndex);

CellRangeAddress[] ruleRange = {CellRangeAddress.valueOf("A2:A100")};

sheetCF.addConditionalFormatting(ruleRange, rule);

Viewing all articles
Browse latest Browse all 120

Latest Images

Trending Articles



Latest Images