MindFusion.Wpf Pack Programmer's Guide
CellRange.Sort Method
See Also
 





Sorts the data in this range according to the specified options.

Namespace: MindFusion.Spreadsheet.Wpf
Assembly: MindFusion.Spreadsheet.Wpf

 Syntax

C#  Copy Code

public bool Sort (
    SortOptions options
)

Visual Basic  Copy Code

Public Function Sort( _
    options As SortOptions _
) As Boolean

 Parameters

options

The sort settings, such as sort keys and direction.

 Return Value

true if the sort was successful; otherwise, false.

 Remarks

The sorting will fail if there are no keys specified or if all keys are outside of the current range.

 Example

The following example illustrates how to sort the data in range A1:D10 in an existing worksheet by the first column.

C#  Copy Code

SortOptions options = new SortOptions();
options.Keys.Add(new SortKey(0));
worksheet.CellRanges["A1:D10"].Sort(options);

Visual Basic  Copy Code

Dim options As New SortOptions()
options.Keys.Add(New SortKey(0))
worksheet.CellRanges("A1:D10").Sort(options)

 See Also

CellRange Members
CellRange Class
MindFusion.Spreadsheet.Wpf Namespace