[]
Represents a sort field that sorts data by a specified conditional-formatting icon.
Use 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.
public class IconSortField : SortFieldBase, IIconSortField, ISortField
Public Class IconSortField
Inherits SortFieldBase
Implements IIconSortField, ISortField
worksheet.Range["A1:B4"].Value = new object[,] {
{"Name", "Score"},
{"A", 90},
{"B", 70},
{"C", 50}
};
IIconSetCondition iconSet = worksheet.Range["B2:B4"].FormatConditions.AddIconSetCondition();
iconSet.IconSet = workbook.IconSets[IconSetType.Icon3TrafficLights1];
IconSortField sortField = new IconSortField(
worksheet.Range["B2:B4"],
workbook.IconSets[IconSetType.Icon3TrafficLights1][2],
SortOrder.Ascending);
worksheet.Sort.SortFields.Add(sortField);
| Name | Description |
|---|---|
| IconSortField(IRange, IIcon, SortOrder) | Sorts by icon. This constructor forwards to IconSortField(IRange, IIcon, SortOrder) with Ascending. |
| Name | Description |
|---|---|
| Icon | Gets the IIcon object used to sort by. |
| Order | Gets the sort order. |
| SortOn | Gets the sort type. This value indicates that the sort field evaluates cells by icon. |