[]
        
(Showing Draft Content)

IIconSortField

Interface IIconSortField

All Superinterfaces:
ISortField
All Known Implementing Classes:
IconSortField

public interface IIconSortField extends ISortField
Represents the sort field by icon.

An IIconSortField defines an icon-based sort key for a range and extends ISortField. Use this interface to specify both the IIcon to sort by and the SortOrder applied to that icon criterion.


 worksheet.getRange("A1:A4").setValue(new Object[][] {{3}, {1}, {4}, {2}});
 IRange keyRange = worksheet.getRange("A1:A4");
 keyRange.getFormatConditions().addIconSetCondition().setIconSet(
     workbook.getIconSets().get(IconSetType.Icon3TrafficLights1));
 IIcon icon = workbook.getIconSets().get(IconSetType.Icon3TrafficLights1).get(0);
 IIconSortField sortField = new IconSortField(keyRange, icon, SortOrder.Descending);
 ISort sort = worksheet.getSort();
 sort.getSortFields().add(sortField);
 sort.setRange(keyRange);
 sort.apply();
 
  • Method Details

    • getOrder

      SortOrder getOrder()
      Gets the sort order.

      Returns the SortOrder that determines whether matching icons are sorted in ascending or descending order.

      
       worksheet.getRange("A1:A4").setValue(new Object[][] {{3}, {1}, {4}, {2}});
       IIcon icon = workbook.getIconSets().get(IconSetType.Icon3TrafficLights1).get(0);
       IIconSortField sortField = new IconSortField(worksheet.getRange("A1:A4"), icon, SortOrder.Descending);
       SortOrder order = sortField.getOrder();
       
      Returns:
      The sort order for this icon sort field.
    • getIcon

      IIcon getIcon()
      Gets the IIcon object used to sort by.

      Use this method to retrieve the IIcon associated with the current icon sort field.

      
       IIcon icon = workbook.getIconSets().get(IconSetType.Icon3Arrows).get(0);
       IIconSortField sortField = new IconSortField(worksheet.getRange("A2:A4"), icon);
       IIcon sortIcon = sortField.getIcon();
       
      Returns:
      The IIcon object used to sort by.