Back to Devexpress

Worksheet.Sort(CellRange) Method

officefileapi-devexpress-dot-spreadsheet-dot-worksheet-dot-sort-x28-devexpress-dot-spreadsheet-dot-cellrange-x29.md

latest4.2 KB
Original Source

Worksheet.Sort(CellRange) Method

Sorts the specified range by the first column in ascending order.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void Sort(
    CellRange range
)
vb
Sub Sort(
    range As CellRange
)

Parameters

NameTypeDescription
rangeCellRange

A CellRange object that is the range of cells in a worksheet.

|

Remarks

Cell data are sorted using default built-in comparer. Text values are sorted depending on the current culture, numbers are sorted smallest to largest, dates and times are sorted oldest to newest.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Sort(CellRange) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_API_Part02/SpreadsheetActions/SortActions.cs#L35

csharp
CellRange range = worksheet.Range["A2:A7"];
worksheet.Sort(range);

wpf-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/SortActions.cs#L38

csharp
CellRange range = worksheet.Range["A2:A7"];
worksheet.Sort(range);

spreadsheet-document-api-examples-part2/CS/SpreadsheetDocServerAPIPart2/CodeExamples/SortActions.cs#L30

csharp
CellRange range = worksheet.Range["A2:A7"];
worksheet.Sort(range);

winforms-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_API_Part02/SpreadsheetActions/SortActions.vb#L35

vb
Dim range As CellRange = worksheet.Range("A2:A7")
worksheet.Sort(range)

wpf-spreadsheetcontrol-api-part-2/VB/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/SortActions.vb#L36

vb
Dim range As CellRange = worksheet.Range("A2:A7")
worksheet.Sort(range)

spreadsheet-document-api-examples-part2/VB/SpreadsheetDocServerAPIPart2/CodeExamples/SortActions.vb#L27

vb
Dim range As CellRange = worksheet.Range("A2:A7")
worksheet.Sort(range)

See Also

Worksheet Interface

Worksheet Members

DevExpress.Spreadsheet Namespace