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

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

Introduction

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

Prototype

ConditionType FILTER

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

Click Source Link

Document

This conditional formatting rule that files the 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());/*from ww w . ja va2 s . co  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();
}