Search in sources :

Example 1 with DataBarFormatting

use of org.apache.poi.hssf.record.cf.DataBarFormatting in project poi by apache.

the class CFRule12Record method createDataBarFormatting.

public DataBarFormatting createDataBarFormatting() {
    if (data_bar != null)
        return data_bar;
    // Convert, setup and return
    setConditionType(CONDITION_TYPE_DATA_BAR);
    data_bar = new DataBarFormatting();
    return data_bar;
}
Also used : DataBarFormatting(org.apache.poi.hssf.record.cf.DataBarFormatting)

Example 2 with DataBarFormatting

use of org.apache.poi.hssf.record.cf.DataBarFormatting in project poi by apache.

the class CFRule12Record method create.

/**
     * Creates a new Data Bar formatting
     * 
     * @param sheet the sheet
     * @param color the data bar color
     * 
     * @return a new Data Bar formatting
     */
public static CFRule12Record create(HSSFSheet sheet, ExtendedColor color) {
    CFRule12Record r = new CFRule12Record(CONDITION_TYPE_DATA_BAR, ComparisonOperator.NO_COMPARISON);
    DataBarFormatting dbf = r.createDataBarFormatting();
    dbf.setColor(color);
    dbf.setPercentMin((byte) 0);
    dbf.setPercentMax((byte) 100);
    DataBarThreshold min = new DataBarThreshold();
    min.setType(RangeType.MIN.id);
    dbf.setThresholdMin(min);
    DataBarThreshold max = new DataBarThreshold();
    max.setType(RangeType.MAX.id);
    dbf.setThresholdMax(max);
    return r;
}
Also used : DataBarThreshold(org.apache.poi.hssf.record.cf.DataBarThreshold) DataBarFormatting(org.apache.poi.hssf.record.cf.DataBarFormatting)

Example 3 with DataBarFormatting

use of org.apache.poi.hssf.record.cf.DataBarFormatting in project poi by apache.

the class HSSFConditionalFormattingRule method getDataBarFormatting.

private HSSFDataBarFormatting getDataBarFormatting(boolean create) {
    CFRule12Record cfRule12Record = getCFRule12Record(create);
    if (cfRule12Record == null)
        return null;
    DataBarFormatting databarFormatting = cfRule12Record.getDataBarFormatting();
    if (databarFormatting == null) {
        if (!create)
            return null;
        cfRule12Record.createDataBarFormatting();
    }
    return new HSSFDataBarFormatting(cfRule12Record, sheet);
}
Also used : CFRule12Record(org.apache.poi.hssf.record.CFRule12Record) DataBarFormatting(org.apache.poi.hssf.record.cf.DataBarFormatting)

Aggregations

DataBarFormatting (org.apache.poi.hssf.record.cf.DataBarFormatting)3 CFRule12Record (org.apache.poi.hssf.record.CFRule12Record)1 DataBarThreshold (org.apache.poi.hssf.record.cf.DataBarThreshold)1