GrapeCity.Xaml.SpreadSheet.Data
SortRange Method
Example 


The index of the starting row of the block of cells to sort.
The index of the starting column of the block of cells to sort.
The number of rows in the block of cells.
The number of columns in the block of cells.
Set to true to sort by rows; false to sort by columns.
The SortInfo object with sort criteria and information about how to perform the sort.
Sorts a range of cells in this sheet in the data model.
Syntax
'Declaration
 
Public Function SortRange( _
   ByVal row As Integer, _
   ByVal column As Integer, _
   ByVal rowCount As Integer, _
   ByVal columnCount As Integer, _
   ByVal byRows As Boolean, _
   ByVal sortInfo() As SortInfo _
) As Boolean
'Usage
 
Dim instance As Worksheet
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)
public bool SortRange( 
   int row,
   int column,
   int rowCount,
   int columnCount,
   bool byRows,
   SortInfo[] sortInfo
)

Parameters

row
The index of the starting row of the block of cells to sort.
column
The index of the starting column of the block of cells to sort.
rowCount
The number of rows in the block of cells.
columnCount
The number of columns in the block of cells.
byRows
Set to true to sort by rows; false to sort by columns.
sortInfo
The SortInfo object with sort criteria and information about how to perform the sort.

Return Value

true if the data is successfully sorted; otherwise, false.
Example
This example uses the SortRange method.
for (int i = 0; i < 10; i++)
            {
                gcSpreadSheet1.Sheets[0].SetValue(i, 0, i);
            }

 private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            gcSpreadSheet1.Sheets[0].SortRange(0, 0, 10, 1, true, new GrapeCity.Xaml.SpreadSheet.Data.SortInfo[] { new GrapeCity.Xaml.SpreadSheet.Data.SortInfo(0, false) });            
        }
For i As Integer = 0 To 9
            GcSpreadSheet1.Sheets(0).SetValue(i, 0, i)
        Next

Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
        gcSpreadSheet1.Sheets(0).SortRange(0, 0, 10, 1, True, New GrapeCity.Xaml.SpreadSheet.Data.SortInfo() {New GrapeCity.Xaml.SpreadSheet.Data.SortInfo(0, False)})
    End Sub
Requirements

Target Platforms: Windows Server 2012, Windows RT

See Also

Reference

Worksheet Class
Worksheet Members

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options