[]
        
(Showing Draft Content)

IIconSet

Interface IIconSet


public interface IIconSet
Represents a single set of icons that are used in an icon set conditional formatting rule.

An IIconSet identifies a built-in icon set by its IconSetType and provides access to the individual IIcon objects contained in that set. Use this interface with Workbook.getIconSets() to retrieve an icon set and apply it to an IIconSetCondition.


 IIconSet iconSet = workbook.getIconSets().get(IconSetType.Icon3TrafficLights1);
 IconSetType iconSetType = iconSet.getID();
 IIcon greenLight = iconSet.get(2);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    get(int Index)
    Gets the icon at the specified index.
    int
    Gets the number of icons in the icon set.
    Gets the IconSetType enumeration value that identifies this icon set.
  • Method Details

    • getCount

      int getCount()
      Gets the number of icons in the icon set.

      Use this method to determine how many icons are available before retrieving individual icons from the set.

      
       IIconSet iconSet = workbook.getIconSets().get(IconSetType.Icon3TrafficLights1);
       int iconCount = iconSet.getCount();
       for (int i = 0; i < iconCount; i++) {
           IIcon icon = iconSet.get(i);
       }
       
      Returns:
      The number of icons in the icon set.
    • getID

      IconSetType getID()
      Gets the IconSetType enumeration value that identifies this icon set.

      Use this method to identify which built-in icon set is assigned to an icon set conditional formatting rule.

      
       IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
       IIconSet iconSet = workbook.getIconSets().get(IconSetType.Icon3TrafficLights1);
       condition.setIconSet(iconSet);
       IconSetType iconSetType = condition.getIconSet().getID();
       
      Returns:
      The IconSetType value that identifies this icon set.
    • get

      IIcon get(int Index)
      Gets the icon at the specified index.

      Icons are ordered from the lowest-value icon at index 0 to the highest-value icon at index getCount() - 1.

      
       IIconSet iconSet = workbook.getIconSets().get(IconSetType.Icon3TrafficLights1);
       IIcon greenLight = iconSet.get(2);
       
      Parameters:
      Index - The zero-based index of the icon. The valid range is 0 through getCount() - 1. An index outside this range is invalid and can cause an IndexOutOfBoundsException when the icon is used.
      Returns:
      The icon at the specified index.