如何在Excel中为特定testing填充背景颜色使用Apache POI?

我想填充单元格的值为“失败”的背景颜色,我尝试了下面的代码,但它不工作。

ConditionalFormattingRule rule2 = sheetCF.createConditionalFormattingRule("COUNTIF($J$2:$J$11,J2)=Fail"); PatternFormatting fill2 = rule2.createPatternFormatting(); fill2.setFillBackgroundColor(IndexedColors.RED.index); fill2.setFillPattern(PatternFormatting.SOLID_FOREGROUND); CellRangeAddress[] regions2 = { CellRangeAddress.valueOf("J2:J10") }; sheetCF.addConditionalFormatting(regions2, rule2); 

创build条件格式的公式是什么?