[]
IIconSortField, ISortFieldUse this class to add an icon-based sort condition to a worksheet or table sort. The sort key identifies the cells whose displayed icons are evaluated, and the target IIcon specifies which icon is sorted according to the given SortOrder.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Name", "Score"},
{"A", 90},
{"B", 70},
{"C", 50}
});
IIconSetCondition iconSet = worksheet.getRange("B2:B4").getFormatConditions().addIconSetCondition();
iconSet.setIconSet(workbook.getIconSets().get(IconSetType.Icon3TrafficLights1));
IconSortField sortField = new IconSortField(
worksheet.getRange("B2:B4"),
workbook.getIconSets().get(IconSetType.Icon3TrafficLights1).get(2),
SortOrder.Ascending);
worksheet.getSort().getSortFields().add(sortField);
IconSortField(IRange key,
IIcon icon) IconSortField(IRange key,
IIcon icon,
SortOrder order) getKey, getPriority, getSortOn, setPriorityclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetKey, getPriority, getSortOn, setPriorityThis constructor forwards to IconSortField(IRange,IIcon,SortOrder) with SortOrder.Ascending.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"A", 2}, {"B", 1}, {"C", 1}, {"D", 3}
});
IIconSetCondition iconSet = worksheet.getRange("B1:B4").getFormatConditions().addIconSetCondition();
iconSet.setIconSet(workbook.getIconSets().get(IconSetType.Icon3TrafficLights1));
IconSortField sortField = new IconSortField(
worksheet.getRange("B1:B4"),
workbook.getIconSets().get(IconSetType.Icon3TrafficLights1).get(0));
worksheet.getSort().getSortFields().add(sortField);
key - The range used as the sort key.icon - The icon to sort by. Must not be null.Use this constructor to define an icon-based sort criterion for the specified sort key range. The key identifies the cells whose displayed icons are evaluated, icon specifies the icon to sort by, and order determines whether matching icons are sorted in ascending or descending order.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Name", "Score"},
{"A", 90},
{"B", 70},
{"C", 50}
});
IIconSetCondition iconSet = worksheet.getRange("B2:B4").getFormatConditions().addIconSetCondition();
iconSet.setIconSet(workbook.getIconSets().get(IconSetType.Icon3TrafficLights1));
IconSortField sortField = new IconSortField(
worksheet.getRange("B2:B4"),
workbook.getIconSets().get(IconSetType.Icon3TrafficLights1).get(2),
SortOrder.Ascending);
key - The range used as the sort key. Its displayed conditional-formatting icons are used for sorting.icon - The icon used as the sort criterion.order - The sort order to apply to the icon-based sort field.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);
IconSortField sortField = new IconSortField(worksheet.getRange("A1:A4"), icon, SortOrder.Descending);
SortOrder order = sortField.getOrder();
getOrder in interface IIconSortFieldIIcon object used to sort by.Use this method to retrieve the icon criterion associated with the current icon sort field.
IIcon icon = workbook.getIconSets().get(IconSetType.Icon3Arrows).get(0);
IconSortField sortField = new IconSortField(worksheet.getRange("A2:A4"), icon);
IIcon sortIcon = sortField.getIcon();
getIcon in interface IIconSortFieldIIcon object used to sort by.