Search in sources :

Example 1 with ColorGradientFormatting

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

the class CFRule12Record method createColorGradientFormatting.

public ColorGradientFormatting createColorGradientFormatting() {
    if (color_gradient != null)
        return color_gradient;
    // Convert, setup and return
    setConditionType(CONDITION_TYPE_COLOR_SCALE);
    color_gradient = new ColorGradientFormatting();
    return color_gradient;
}
Also used : ColorGradientFormatting(org.apache.poi.hssf.record.cf.ColorGradientFormatting)

Example 2 with ColorGradientFormatting

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

the class CFRule12Record method createColorScale.

/**
     * Creates a new Color Scale / Color Gradient formatting
     * 
     * @param sheet the sheet
     * 
     * @return a new Color Scale / Color Gradient formatting
     */
public static CFRule12Record createColorScale(HSSFSheet sheet) {
    int numPoints = 3;
    ExtendedColor[] colors = new ExtendedColor[numPoints];
    ColorGradientThreshold[] ts = new ColorGradientThreshold[numPoints];
    for (int i = 0; i < ts.length; i++) {
        ts[i] = new ColorGradientThreshold();
        colors[i] = new ExtendedColor();
    }
    CFRule12Record r = new CFRule12Record(CONDITION_TYPE_COLOR_SCALE, ComparisonOperator.NO_COMPARISON);
    ColorGradientFormatting cgf = r.createColorGradientFormatting();
    cgf.setNumControlPoints(numPoints);
    cgf.setThresholds(ts);
    cgf.setColors(colors);
    return r;
}
Also used : ColorGradientThreshold(org.apache.poi.hssf.record.cf.ColorGradientThreshold) ColorGradientFormatting(org.apache.poi.hssf.record.cf.ColorGradientFormatting) ExtendedColor(org.apache.poi.hssf.record.common.ExtendedColor)

Example 3 with ColorGradientFormatting

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

the class HSSFConditionalFormattingRule method getColorScaleFormatting.

private HSSFColorScaleFormatting getColorScaleFormatting(boolean create) {
    CFRule12Record cfRule12Record = getCFRule12Record(create);
    if (cfRule12Record == null)
        return null;
    ColorGradientFormatting colorFormatting = cfRule12Record.getColorGradientFormatting();
    if (colorFormatting == null) {
        if (!create)
            return null;
        cfRule12Record.createColorGradientFormatting();
    }
    return new HSSFColorScaleFormatting(cfRule12Record, sheet);
}
Also used : ColorGradientFormatting(org.apache.poi.hssf.record.cf.ColorGradientFormatting) CFRule12Record(org.apache.poi.hssf.record.CFRule12Record)

Aggregations

ColorGradientFormatting (org.apache.poi.hssf.record.cf.ColorGradientFormatting)3 CFRule12Record (org.apache.poi.hssf.record.CFRule12Record)1 ColorGradientThreshold (org.apache.poi.hssf.record.cf.ColorGradientThreshold)1 ExtendedColor (org.apache.poi.hssf.record.common.ExtendedColor)1