[]
An IIconSetCondition applies icon-based conditional formatting to a range and lets you configure the icon set, criteria thresholds, display order, and target range for the rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setIconSet(workbook.getIconSets().get(IconSetType.Icon3Symbols));
condition.getIconCriteria().get(1).setValue(50);
condition.getIconCriteria().get(2).setValue(70);
voiddelete()voidIRange that specifies the cell range to which the formatting rule is applied.booleanIIconCriteria collection, which represents the set of criteria for an icon set conditional formatting rule.booleanintbooleanbooleanbooleantrue.getType()voidsetAppliesTo(IRange value) IRange that specifies the cell range to which the formatting rule is applied.void1 so that it will be evaluated before all other rules on the worksheet.voidsetIconSet(IIconSet value) IIconSet used in the conditional format.voidvoidsetPercentileValues(boolean value) voidsetPriority(int value) voidsetReverseOrder(boolean value) voidsetShowIconOnly(boolean value) toJson()IRange that specifies the cell range to which the formatting rule is applied. Use setAppliesTo(IRange) to change the range associated with this icon set conditional formatting rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setAppliesTo(worksheet.getRange("B1:B5"));
IRange appliesTo = condition.getAppliesTo();
IRange to which the formatting rule is applied.IRange that specifies the cell range to which the formatting rule is applied. Use this method to apply the current icon set conditional formatting rule to a different range.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setAppliesTo(worksheet.getRange("B1:B5"));
value - The IRange to which the formatting rule is applied.IIconCriteria collection, which represents the set of criteria for an icon set conditional formatting rule. Each item in the returned collection represents the threshold settings for one icon in the current icon set.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setIconSet(workbook.getIconSets().get(IconSetType.Icon3Symbols));
IIconCriteria criteria = condition.getIconCriteria();
IIconCriteria collection for the icon set conditional formatting rule.Returns the IIconSet currently applied to this icon set conditional formatting rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setIconSet(workbook.getIconSets().get(IconSetType.Icon3TrafficLights1));
IIconSet iconSet = condition.getIconSet();
IIconSet used in the conditional format.IIconSet used in the conditional format. Use this method to apply a predefined IIconSet from the workbook's IIconSets collection to an icon set conditional formatting rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setIconSet(workbook.getIconSets().get(IconSetType.Icon3TrafficLights1));
value - The IIconSet to use for the conditional format.This property returns false if not every threshold is set to percentile. Use setPercentileValues(boolean) to change all threshold types to percentile at once.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setPercentileValues(true);
boolean percentileValues = condition.getPercentileValues();
true if the thresholds for the icon set conditional format are determined by using percentiles; otherwise, false.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setPercentileValues(true);
value - true if the thresholds for the icon set conditional format are determined by using percentiles; otherwise, false.The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet. Priority values are unique within the worksheet, so changing the priority of one rule can shift the priority values of other rules.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition firstRule = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
IIconSetCondition secondRule = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
secondRule.setPriority(1);
int priority = secondRule.getPriority();
The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet. Priority values are unique within the worksheet, so changing the priority of one rule can shift the priority values of other rules.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition firstRule = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
IIconSetCondition secondRule = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
secondRule.setPriority(1);
value - The priority value of the conditional formatting rule.Returns true when the icon set conditional format displays icons in reverse order. Returns false when the default icon order is used.
IIconSetCondition condition = worksheet.getRange("A1:A3").getFormatConditions().addIconSetCondition();
condition.setReverseOrder(true);
boolean reverseOrder = condition.getReverseOrder();
true if the order of icons is reversed for the icon set; false otherwise.Sets true when the icon set conditional format displays icons in reverse order. Sets false when the default icon order is used.
IIconSetCondition condition = worksheet.getRange("A1:A3").getFormatConditions().addIconSetCondition();
condition.setReverseOrder(true);
value - true if the order of icons is reversed for the icon set; false otherwise.Returns true when cells that use this icon set rule display only the icon. Returns false when the icon is displayed together with the cell value.
worksheet.getRange("A1:A3").setValue(new Object[][] {
{10},
{50},
{90}
});
IIconSetCondition condition = worksheet.getRange("A1:A3").getFormatConditions().addIconSetCondition();
condition.setIconSet(workbook.getIconSets().get(IconSetType.Icon3Symbols));
condition.setShowIconOnly(true);
boolean showIconOnly = condition.getShowIconOnly();
true if only the icon is displayed; otherwise, false.Sets true when cells that use this icon set rule display only the icon. Sets false when the icon is displayed together with the cell value.
worksheet.getRange("A1:A3").setValue(new Object[][] {
{10},
{50},
{90}
});
IIconSetCondition condition = worksheet.getRange("A1:A3").getFormatConditions().addIconSetCondition();
condition.setIconSet(workbook.getIconSets().get(IconSetType.Icon3Symbols));
condition.setShowIconOnly(true);
value - true if only the icon is displayed; otherwise, false.true. When this method returns true, subsequent rules are not evaluated for a cell after this rule evaluates to true. When it returns false, evaluation can continue with later rules.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
boolean stopIfTrue = condition.getStopIfTrue();
true if subsequent rules are skipped when this rule evaluates to true; otherwise, false.For an icon set conditional formatting rule, this method returns FormatConditionType.IconSets.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
FormatConditionType type = condition.getType();
Use this method to remove the current icon set conditional formatting rule from the worksheet.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setIconSet(workbook.getIconSets().get(IconSetType.Icon3Symbols));
condition.delete();
1 so that it will be evaluated before all other rules on the worksheet. Use this method to move the current icon set rule to the highest evaluation priority when multiple conditional formatting rules apply to the worksheet.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition firstRule = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
IIconSetCondition secondRule = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
secondRule.setFirstPriority();
int priority = secondRule.getPriority();
Use this method to move the rule to the lowest priority when multiple conditional formatting rules exist on the same worksheet.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition firstRule = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
IIconSetCondition secondRule = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
firstRule.setPriority(1);
secondRule.setLastPriority();
An icon set rule is custom when one or more criteria use an icon that does not come from the rule's selected IIconSet, including IconType.NoCellIcon.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
boolean custom = condition.getCustom();
true if this is a custom icon set condition; otherwise, false.Updates this icon set conditional formatting rule by deserializing the specified JSON content. The JSON string should represent an icon set conditional format, such as one generated by toJson().
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition source = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
source.setIconSet(workbook.getIconSets().get(IconSetType.Icon3TrafficLights1));
String json = source.toJson();
IIconSetCondition target = worksheet.getRange("B1:B5").getFormatConditions().addIconSetCondition();
target.fromJson(json);
json - The JSON string that defines the icon set conditional format.IllegalStateException - if the JSON string does not represent an icon set conditional format.The returned string contains the serialized definition of this icon set conditional formatting rule.
worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setIconSet(workbook.getIconSets().get(IconSetType.Icon3TrafficLights1));
String json = condition.toJson();