I am trying to create an empty excel template using apache poi java. I need to add a rule - when column no. 3 is populated then columns from 7 to 12 need to be highlighted in some color (as a mandatory indicator for the user).
I could find below code which colors the cell when the condition is met on the same cell. But I want to color/format different cells when the condition is met on current cell.
` XSSFSheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();
ConditionalFormattingRule rule1 = sheetCF.createConditionalFormattingRule(ComparisonOperator.GT, "5");
PatternFormatting patternFmt = rule1.createPatternFormatting();
patternFmt.setFillBackgroundColor(IndexedColors.YELLOW.index);
sheetCF.addConditionalFormatting(addressList.getCellRangeAddresses(), rule1); //when rule1 is met, same cell is colored yellow
But I want is when rule1 is met, then color a different cell range.
Is this possible in poi and how ?