[]
Use this interface to configure a rule that matches values above average, below average, equal to or above average, equal to or below average, above the standard deviation, or below the standard deviation.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setAboveBelow(AboveBelow.BelowAverage);
voiddelete()voidAboveBelow enumeration, specifying how the conditional formatting rule compares cell values with the range average or a standard deviation threshold.IBorders which represents the borders of this conditional format.getFont()IFont which represents the font of this conditional format.IInterior which represents the background color of this conditional format.intintbooleangetType()voidsetAboveBelow(AboveBelow value) AboveBelow enumeration, specifying how the conditional formatting rule compares cell values with the range average or a standard deviation threshold.voidsetAppliesTo(IRange value) void1 so that it will be evaluated before all other rules on the worksheet.voidvoidsetNumberFormat(String value) voidsetNumStdDev(int value) voidsetPriority(int value) voidsetStopIfTrue(boolean value) toJson()AboveBelow enumeration, specifying how the conditional formatting rule compares cell values with the range average or a standard deviation threshold. Use this method to determine whether the rule evaluates values that are above average, below average, equal to or above average, equal to or below average, above the standard deviation, or below the standard deviation.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setAboveBelow(AboveBelow.BelowAverage);
AboveBelow aboveBelow = format.getAboveBelow();
AboveBelow constants that specifies whether the conditional formatting rule evaluates cell values against the range average or the standard deviation threshold.AboveBelow enumeration, specifying how the conditional formatting rule compares cell values with the range average or a standard deviation threshold. Use this method to control whether the rule evaluates values that are above average, below average, equal to or above average, equal to or below average, above the standard deviation, or below the standard deviation.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setAboveBelow(AboveBelow.BelowAverage);
value - One of the AboveBelow constants that specifies whether the conditional formatting rule evaluates cell values against the range average or the standard deviation threshold; must not be null.Use this method to retrieve the target range of the current above-average conditional formatting rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setAppliesTo(worksheet.getRange("B1:B5"));
IRange range = format.getAppliesTo();
Use this method to reassign an existing above-average conditional formatting rule to a different IRange.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setAppliesTo(worksheet.getRange("B1:B5"));
value - The IRange object that specifies the cell range to which the formatting rule is applied.IBorders which represents the borders of this conditional format. Use the returned IBorders object to configure the border style that is applied when this above-average conditional formatting rule evaluates to true.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
IBorders borders = format.getBorders();
borders.setColor(Color.GetRed());
IBorders instance that represents the borders of this conditional format.IFont which represents the font of this conditional format.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
IFont font = format.getFont();
font.setBold(true);
IFont instance that represents the font of this conditional format.IInterior which represents the background color of this conditional format. Use the returned IInterior object to access or modify the fill settings applied when the above-average conditional formatting rule is in effect.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
IInterior interior = format.getInterior();
interior.setColor(Color.GetYellow());
IInterior that represents the background color of this conditional format.Use this method to retrieve the format code currently configured for an above-average conditional formatting rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setNumberFormat("0.00");
String numberFormat = format.getNumberFormat();
true.Use this method to set the number format applied when the above-average conditional formatting rule evaluates to true.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setNumberFormat("0.00");
value - The number format string applied when the conditional formatting rule evaluates to true.Use this method to get the standard deviation value assigned to the above-average conditional formatting rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setNumStdDev(2);
int numStdDev = format.getNumStdDev();
Use this method to set the standard deviation value assigned to the above-average conditional formatting rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setNumStdDev(2);
value - The numeric standard deviation for the above average rule.The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
IAboveAverage condition = worksheet.getRange("B1:B5").getFormatConditions().addAboveAverage();
condition.getInterior().setColor(Color.GetLightBlue());
format.setPriority(2);
int priority = format.getPriority();
The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet.
When setting the priority, the value must be a positive integer between 1 and the total number of conditional formatting rules on the worksheet. The priority must be a unique value for all rules on the worksheet, so changing the priority for the specified conditional formatting rule may cause the priority value of the other rules on the worksheet to be shifted.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
IAboveAverage condition = worksheet.getRange("B1:B5").getFormatConditions().addAboveAverage();
condition.getInterior().setColor(Color.GetLightBlue());
format.setPriority(2);
value - The priority value of the conditional formatting rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setStopIfTrue(true);
boolean stopIfTrue = format.getStopIfTrue();
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setStopIfTrue(true);
value - A boolean value that determines whether additional formatting rules on the cell should be evaluated if the current rule evaluates to true.For an IAboveAverage rule, this method returns FormatConditionType.AboveAverageCondition.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
FormatConditionType type = format.getType();
Use this method to remove an above-average conditional formatting rule that was previously added to a range.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.delete();
1 so that it will be evaluated before all other rules on the worksheet. Use setLastPriority() to move the rule to the end of the worksheet's conditional formatting evaluation order.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
ITop10 top10 = worksheet.getRange("A1:A5").getFormatConditions().addTop10();
top10.getInterior().setColor(Color.GetYellow());
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetLightBlue());
format.setFirstPriority();
Use this method to move the rule to the end of the worksheet-level conditional formatting priority order when multiple rules exist.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
ITop10 top10 = worksheet.getRange("A1:A5").getFormatConditions().addTop10();
top10.getInterior().setColor(Color.GetYellow());
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetLightBlue());
format.setLastPriority();
Use this method to restore the settings of an above average conditional format from a JSON string, such as one generated by toJson().
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
String json = "{\"ranges\":[{\"row\":0,\"col\":1,\"rowCount\":5,\"colCount\":1}],\"priority\":1,\"ruleType\":8,\"type\":0}";
IAboveAverage format = worksheet.getRange("B1:B5").getFormatConditions().addAboveAverage();
format.fromJson(json);
format.getInterior().setColor(Color.GetYellow());
json - The JSON string that defines the conditional format.The returned string contains the serialized state of this IAboveAverage rule and can be used with fromJson(String) to restore the conditional format.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {20}, {30}, {40}, {50}});
IAboveAverage format = worksheet.getRange("A1:A5").getFormatConditions().addAboveAverage();
format.getInterior().setColor(Color.GetYellow());
format.setAboveBelow(AboveBelow.AboveAverage);
String json = format.toJson();