Sort Cells
From Documentation
Revision as of 06:59, 22 August 2013 by Hawk (talk | contribs) (moved ZK Spreadsheet Essentials 3/Working with Spreadsheet/Handling Data Model/Sort Cells to ZK Spreadsheet Essentials/Working with Spreadsheet/Handling Data Model/Sort Cells)
Sorting a range of cell data is a commonly-used feature. To sort cells with Range is quite easy like:
//true for descending order, false for ascending
range.sort(true);
//use CellOperationUtil, it checks sheet protection before sorting
CellOperationUtil.sort(range, true);
When sorting a range of texts and numbers In ascending order, numbers will be arranged before text.
A range of cells before sorting:
A range of cells after sorting in ascending order:
All source code listed in this book is at Github.