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

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

Introduction

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

Prototype

ConditionType ICON_SET

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

Click Source Link

Document

This conditional formatting rule sets a data bar, with the cell populated with bars based on their values

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());// w w  w.j  a  v  a 2s  .  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();
}