Search in sources :

Example 1 with ColorGradientThreshold

use of org.apache.poi.hssf.record.cf.ColorGradientThreshold 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)

Aggregations

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