Data sorter for multiple sheets within a workbook

Hi Team,

I understood to achieve data sorting , we need to obtain the DataSorter from the workbook instance. If I have multiple worksheets within a single workbook and I need to sort data in multiple worksheets, how should I instantiate the DataSorter ?

My above concern is because, how would I be able to achieve this across multiple sheets when I don’t have connectivity within each sheet ?

Please advice.

Thanks
Thilak Babu

@Thilakbabu,

You can get the DataSorter object from the workbook and then sort data for different sheets separately. Aspose.Cells follows MS Excel standards and specifications when sorting data. You will specify the cells of each worksheet (for first parameter) and specify range/area of the sheet (for other parameter(s)) for data sorting. See the sort method overloads you may choose:

int[] sort(Cells cells, CellArea area)
int[] sort(Cells cells, int startRow, int startColumn, int endRow, int endColumn)

In MS Excel, you will sort data based on displayed columns in the current/displayed sheet using “Sort” command. You cannot sort data in other sheets while remaining in the current sheet.

See the document on data sorting for your reference.