byte comparisonOperation,
String formula1,
String formula2) {
XSSFConditionalFormattingRule rule = new XSSFConditionalFormattingRule(_sheet);
CTCfRule cfRule = rule.getCTCfRule();
cfRule.addFormula(formula1);
if(formula2 != null) cfRule.addFormula(formula2);
cfRule.setType(STCfType.CELL_IS);
STConditionalFormattingOperator.Enum operator;
switch (comparisonOperation){
case ComparisonOperator.BETWEEN: operator = STConditionalFormattingOperator.BETWEEN; break;
case ComparisonOperator.NOT_BETWEEN: operator = STConditionalFormattingOperator.NOT_BETWEEN; break;
case ComparisonOperator.LT: operator = STConditionalFormattingOperator.LESS_THAN; break;
case ComparisonOperator.LE: operator = STConditionalFormattingOperator.LESS_THAN_OR_EQUAL; break;
case ComparisonOperator.GT: operator = STConditionalFormattingOperator.GREATER_THAN; break;
case ComparisonOperator.GE: operator = STConditionalFormattingOperator.GREATER_THAN_OR_EQUAL; break;
case ComparisonOperator.EQUAL: operator = STConditionalFormattingOperator.EQUAL; break;
case ComparisonOperator.NOT_EQUAL: operator = STConditionalFormattingOperator.NOT_EQUAL; break;
default: throw new IllegalArgumentException("Unknown comparison operator: " + comparisonOperation);
}
cfRule.setOperator(operator);
return rule;
}