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





Sorts the data in the specified range according to the specified criteria.

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

 Syntax

C#  Copy Code

public bool Sort (
    CellRange range,
    SortOptions options
)

Visual Basic  Copy Code

Public Function Sort( _
    range As CellRange, _
    options As SortOptions _
) As Boolean

 Parameters

range

The range to sort.

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

Worksheet Members
Worksheet Class
MindFusion.Spreadsheet.Wpf Namespace