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