[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ISortFields.Add

Add Method

Add(ISortField)

Adds a sort field.

Use this method to add a sort condition, such as a value, icon, font color, or cell color sort field, to the sort field list returned by SortFields. After the required sort fields are added, call Apply() to apply the sort.

Declaration
void Add(ISortField sortField)
Sub Add(sortField As ISortField)
Parameters
Type Name Description
ISortField sortField

The sort field to add.

Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Name", "Score"},
    {"Tom", 90},
    {"Amy", 75},
    {"Bob", 85}
};
ITable table = worksheet.Tables.Add(worksheet.Range["A1:B4"], true);
ISortField sortField = new ValueSortField(worksheet.Range["B1:B2"], SortOrder.Ascending);
table.Sort.SortFields.Add(sortField);