[]
Applies the configured sort settings to the current range.
Call this method after setting the sort range and adding the required sort fields. If Header is true, the first row in the sort range is treated as a header row and is not moved.
void Apply()
Sub Apply()
worksheet.Range["A1:B4"].Value = new object[,] {
{"Name", "Score"},
{"Tom", 80},
{"Amy", 95},
{"Bob", 90}
};
ISort sort = worksheet.Sort;
sort.SortFields.Add(new ValueSortField(worksheet.Range["B2:B4"], SortOrder.Descending));
sort.Range = worksheet.Range["A1:B4"];
sort.Header = true;
sort.Apply();