We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Sort data with four or more keys

Hi guys,


I use Aspose.Cells for .net. My question is Can I sort data with more than 4 keys?
Now i see only DataSorter class that can sort only with 3 keys.

Thank in advance.

Hi,


Sure, you may add more keys accordingly for your needs, see the sample code snippet below:


DataSorter sorter = workbook.DataSorter;
sorter.AddKey(4, Aspose.Cells.SortOrder.Ascending);
sorter.AddKey(5, Aspose.Cells.SortOrder.Ascending);
sorter.AddKey(6, Aspose.Cells.SortOrder.Ascending);
sorter.AddKey(7, Aspose.Cells.SortOrder.Ascending);

sorter.Sort(workbook.Worksheets[“Sheet1”].Cells, cellarea);

Thank you very much!

Hi,


Good to know that it works for you.

Feel free to contact us any time if you have any other issue or have some other query, we will be happy to assist you soon.

thank you.