Sorts a range of cells on this sheet in the data model.
Syntax
| Visual Basic (Usage) | Copy Code |
|---|
Dim instance As SheetView
Dim row As Integer
Dim column As Integer
Dim rowCount As Integer
Dim columnCount As Integer
Dim byRows As Boolean
Dim sortInfo() As SortInfo
Dim value As Boolean
value = instance.SortRange(row, column, rowCount, columnCount, byRows, sortInfo)
|
Parameters
- row
- Index of the starting row of the block of cells to sort
- column
- Index of the starting column of the block of cells to sort
- rowCount
- Number of rows in the block of cells
- columnCount
- Number of columns in the block of cells
- byRows
- Whether to sort by rows (or else by columns)
- sortInfo
- SortInfo object with sort criteria and how to perform sort
Return Value
Boolean:
true if successful;
false otherwise.
Example
This example sorts a range of cells in the sheet.
| C# | Copy Code |
|---|
FarPoint.Win.Spread.SortInfo[] sort = new FarPoint.Win.Spread.SortInfo[1];
sort[0] = new
FarPoint.Win.Spread.SortInfo(0, true, System.Collections.Comparer.Default);
fpSpread1.ActiveSheet.SetValue(0, 0, "C");
fpSpread1.ActiveSheet.SetValue(1, 0, "A");
fpSpread1.ActiveSheet.SetValue(2, 0, "E");
fpSpread1.ActiveSheet.SetValue(3, 0, "B");
fpSpread1.ActiveSheet.SetValue(0, 1, "3");
fpSpread1.ActiveSheet.SetValue(1, 1, "5");
fpSpread1.ActiveSheet.SetValue(2, 1, "1");
fpSpread1.ActiveSheet.SetValue(3, 1, "2");
fpSpread1.ActiveSheet.SortRange(0, 0, 4, 2, true, sort); |
| Visual Basic | Copy Code |
|---|
Dim sort(1) As FarPoint.Win.Spread.SortInfo
sort(0) = New FarPoint.Win.Spread.SortInfo(0, True, System.Collections.Comparer.Default)
FpSpread1.ActiveSheet.SetValue(0, 0, "C")
FpSpread1.ActiveSheet.SetValue(1, 0, "A")
FpSpread1.ActiveSheet.SetValue(2, 0, "E")
FpSpread1.ActiveSheet.SetValue(3, 0, "B")
FpSpread1.ActiveSheet.SetValue(0, 1, "3")
FpSpread1.ActiveSheet.SetValue(1, 1, "5")
FpSpread1.ActiveSheet.SetValue(2, 1, "1")
FpSpread1.ActiveSheet.SetValue(3, 1, "2")
FpSpread1.ActiveSheet.SortRange(0, 0, 4, 2, True, sort) |
Remarks
See Also