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;
}
Aggregations