[]
        
(Showing Draft Content)

IIconSetCondition

Interface IIconSetCondition


public interface IIconSetCondition
Represents an icon set conditional formatting rule.

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);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes this conditional format.
    void
    Loads an icon set conditional formatting rule from a JSON string into this object.
    Returns an IRange that specifies the cell range to which the formatting rule is applied.
    boolean
    Returns a Boolean value indicating whether this is a custom icon set condition.
    Gets an IIconCriteria collection, which represents the set of criteria for an icon set conditional formatting rule.
    Gets the icon set used in the conditional format.
    boolean
    Returns a Boolean value indicating if the thresholds for an icon set conditional format are determined by using percentiles.
    int
    Gets the priority value of the conditional formatting rule.
    boolean
    Returns a Boolean value indicating if the order of icons is reversed for an icon set.
    boolean
    Gets a Boolean value indicating if only the icon is displayed for an icon set conditional format.
    boolean
    Gets whether subsequent conditional formatting rules are skipped when this rule evaluates to true.
    Returns the type of this conditional format.
    void
    Sets an IRange that specifies the cell range to which the formatting rule is applied.
    void
    Sets the priority value for this conditional formatting rule to 1 so that it will be evaluated before all other rules on the worksheet.
    void
    Sets the IIconSet used in the conditional format.
    void
    Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.
    void
    setPercentileValues(boolean value)
    Sets a Boolean value indicating if the thresholds for an icon set conditional format are determined by using percentiles.
    void
    setPriority(int value)
    Sets the priority value of the conditional formatting rule.
    void
    setReverseOrder(boolean value)
    Sets a Boolean value indicating if the order of icons is reversed for an icon set.
    void
    setShowIconOnly(boolean value)
    Sets a Boolean value indicating if only the icon is displayed for an icon set conditional format.
    Generates a JSON string from the conditional format.
  • Method Details

    • getAppliesTo

      IRange getAppliesTo()
      Returns an 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();
       
      Returns:
      The IRange to which the formatting rule is applied.
    • setAppliesTo

      void setAppliesTo(IRange value)
      Sets an 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"));
       
      Parameters:
      value - The IRange to which the formatting rule is applied.
    • getIconCriteria

      IIconCriteria getIconCriteria()
      Gets an 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();
       
      Returns:
      The IIconCriteria collection for the icon set conditional formatting rule.
    • getIconSet

      IIconSet getIconSet()
      Gets the icon set used in the conditional format.

      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();
       
      Returns:
      The IIconSet used in the conditional format.
    • setIconSet

      void setIconSet(IIconSet value)
      Sets the 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));
       
      Parameters:
      value - The IIconSet to use for the conditional format.
    • getPercentileValues

      boolean getPercentileValues()
      Returns a Boolean value indicating if the thresholds for an icon set conditional format are determined by using percentiles.

      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();
       
      Returns:
      true if the thresholds for the icon set conditional format are determined by using percentiles; otherwise, false.
    • setPercentileValues

      void setPercentileValues(boolean value)
      Sets a Boolean value indicating if the thresholds for an icon set conditional format are determined by using percentiles.
      
       worksheet.getRange("A1:A5").setValue(new Object[][] {{10}, {30}, {50}, {70}, {90}});
       IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
       condition.setPercentileValues(true);
       
      Parameters:
      value - true if the thresholds for the icon set conditional format are determined by using percentiles; otherwise, false.
    • getPriority

      int getPriority()
      Gets the priority value of the conditional formatting rule.

      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();
       
      Returns:
      The priority value of the conditional formatting rule.
    • setPriority

      void setPriority(int value)
      Sets the priority value of the conditional formatting rule.

      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);
       
      Parameters:
      value - The priority value of the conditional formatting rule.
    • getReverseOrder

      boolean getReverseOrder()
      Returns a Boolean value indicating if the order of icons is reversed for an icon set.

      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();
       
      Returns:
      true if the order of icons is reversed for the icon set; false otherwise.
    • setReverseOrder

      void setReverseOrder(boolean value)
      Sets a Boolean value indicating if the order of icons is reversed for an icon set.

      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);
       
      Parameters:
      value - true if the order of icons is reversed for the icon set; false otherwise.
    • getShowIconOnly

      boolean getShowIconOnly()
      Gets a Boolean value indicating if only the icon is displayed for an icon set conditional format.

      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();
       
      Returns:
      true if only the icon is displayed; otherwise, false.
    • setShowIconOnly

      void setShowIconOnly(boolean value)
      Sets a Boolean value indicating if only the icon is displayed for an icon set conditional format.

      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);
       
      Parameters:
      value - true if only the icon is displayed; otherwise, false.
    • getStopIfTrue

      boolean getStopIfTrue()
      Gets whether subsequent conditional formatting rules are skipped when this rule evaluates to 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();
       
      Returns:
      true if subsequent rules are skipped when this rule evaluates to true; otherwise, false.
    • getType

      Returns the type of this conditional format.

      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();
       
      Returns:
      The type of this conditional format.
    • delete

      void delete()
      Deletes this conditional format.

      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();
       
    • setFirstPriority

      void setFirstPriority()
      Sets the priority value for this conditional formatting rule to 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();
       
    • setLastPriority

      void setLastPriority()
      Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet.

      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();
       
    • getCustom

      boolean getCustom()
      Returns a Boolean value indicating whether this is a custom icon set condition.

      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();
       
      Returns:
      true if this is a custom icon set condition; otherwise, false.
    • fromJson

      void fromJson(String json)
      Loads an icon set conditional formatting rule from a JSON string into this object.

      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);
       
      Parameters:
      json - The JSON string that defines the icon set conditional format.
      Throws:
      IllegalStateException - if the JSON string does not represent an icon set conditional format.
    • toJson

      String toJson()
      Generates a JSON string from the 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();
       
      Returns:
      The conditional format JSON string.