Interface: IFRangeSort
Defined in: sheets-sort/src/facade/f-range.ts:23
Methods
sort()
sort(column): FRange
Defined in: sheets-sort/src/facade/f-range.ts:38
Sorts the cells in the given range, by column(s) and order specified.
Parameters
Parameter | Type | Description |
---|---|---|
column | | SortColumnSpec | SortColumnSpec [] | The column index with order or an array of column indexes with order. The column index starts from 1. |
Returns
The range itself for chaining.
Example
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const range = activeSheet.getRange(0, 0, 10, 10);
range.sort(1); // Sorts the range by the first column in ascending order.
range.sort({ column: 1, ascending: false }); // Sorts the range by the first column in descending order.
range.sort([{ column: 1, ascending: false }, 2]); // Sorts the range by the first column in descending order and the second column in ascending order.