[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ISortField.Priority

Priority Property

Priority

Gets or sets the priority of the ISortField.

This value specifies the precedence of the sort field when multiple sort fields are used in the same sort operation.

Declaration
int Priority { get; set; }
Property Priority As Integer
Examples
worksheet.Range["A1:C5"].Value = new object[,] {
    {"Name", "Score", "Age"},
    {"Alice", 90, 30},
    {"Bob", 85, 28},
    {"Alice", 80, 25},
    {"Bob", 92, 35}
};
ISort sort = worksheet.Sort;
sort.Range = worksheet.Range["A1:C5"];
sort.SortFields.Add(new ValueSortField(worksheet.Range["A2:A5"], SortOrder.Ascending));
sort.SortFields.Add(new ValueSortField(worksheet.Range["B2:B5"], SortOrder.Descending));
ISortField sortField = sort.SortFields[1];
sortField.Priority = 1;
int priority = sortField.Priority;