Example usage for org.apache.poi.ss.usermodel ConditionType FORMULA

List of usage examples for org.apache.poi.ss.usermodel ConditionType FORMULA

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel ConditionType FORMULA.

Prototype

ConditionType FORMULA

To view the source code for org.apache.poi.ss.usermodel ConditionType FORMULA.

Click Source Link

Document

This conditional formatting rule contains a formula to evaluate.

Usage

From source file:de.jlo.talendcomp.excel.SpreadsheetOutput.java

License:Apache License

private static String describeRule(ConditionalFormattingRule rule) {
    StringBuilder sb = new StringBuilder();
    sb.append("condition:");
    ConditionType ct = rule.getConditionType();
    if (ct.equals(ConditionType.CELL_VALUE_IS)) {
        sb.append(" cell value is: ");
        sb.append(describeRuleComparisonOperator(rule));
    } else if (ct.equals(ConditionType.FORMULA)) {
        sb.append(" formula: ");
        sb.append(rule.getFormula1());/*from   ww w .  j  a  va  2  s.c  o  m*/
    } else if (ct.equals(ConditionType.FILTER)) {
        sb.append(" filter: ");
        sb.append(describeRuleComparisonOperator(rule));
    } else if (ct.equals(ConditionType.ICON_SET)) {
        sb.append(" icon set: ");
        sb.append(rule.getMultiStateFormatting());
    } else if (ct.equals(ConditionType.COLOR_SCALE)) {
        sb.append(" color-scale: ");
        sb.append(rule.getColorScaleFormatting());
    } else if (ct.equals(ConditionType.DATA_BAR)) {
        sb.append(" data-bar: ");
        sb.append(rule.getDataBarFormatting());
    } else {
        sb.append(" type=" + rule.getConditionType());
    }
    sb.append(" formattings:");
    if (rule.getBorderFormatting() != null) {
        sb.append(" [has border formats]");
    }
    if (rule.getFontFormatting() != null) {
        sb.append(" [has font formattings]");
    }
    if (rule.getPatternFormatting() != null) {
        sb.append(" [has pattern formattings]");
    }
    return sb.toString();
}