Spread WPF Documentation
Sorting Data

You can sort data in the control and specify a column or row index to sort on as well as the sort criteria.

Use the SortRange method to sort data.

Using Code

The following example sorts a range of cells.

C#
Copy Code
for (int i = 0; i < 10; i++)
            {
                gcSpreadSheet1.Sheets[0].SetValue(i, 0, i);
            }
 private void Button_Click(object sender, RoutedEventArgs e)
        {
gcSpreadSheet1.Sheets[0].SortRange(0, 0, 10, 1, true, new SortInfo[] { new SortInfo(0, false) });
gcSpreadSheet1.Invalidate();
        }
VB.NET
Copy Code
For i As Integer = 0 To 9
            GcSpreadSheet1.Sheets(0).SetValue(i, 0, i)
        Next
Private Sub Button_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
GcSpreadSheet1.Sheets(0).SortRange(0, 0, 10, 1, True, New SortInfo() {New SortInfo(0, False)})
GcSpreadSheet1.Invalidate()
End Sub
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback