To sort data with five keys in Aspose.Cells in Java

Team, i could not able to find the getDataSorter method Cells class. Also could not able to find Sorter class in the latest aspose. Can you share the right package for both these classes?

@Javith,
You may please try the following sample code using the latest version and share your feedback. For more details refer to the following article.
Data Sorting

// Instantiate a new Workbook object.
Workbook workbook = new Workbook("book1.xls");

// Get the workbook datasorter object.
DataSorter sorter = workbook.getDataSorter();

// Set the first order for datasorter object.
sorter.setOrder1(SortOrder.DESCENDING);

// Define the first key.
sorter.setKey1(0);

// Set the second order for datasorter object.
sorter.setOrder2(SortOrder.ASCENDING);

// Define the second key.
sorter.setKey2(1);

// Sort data in the specified data range (CellArea range: A1:B14)
CellArea cellArea = new CellArea();
cellArea.StartRow = 0;
cellArea.StartColumn = 0;
cellArea.EndRow = 13;
cellArea.EndColumn = 1;
sorter.sort(workbook.getWorksheets().get(0).getCells(), cellArea);

// Save the excel file.
workbook.save("DataSorting_out.xls");

// Print message
System.out.println("Sorting Done Successfully");

Hi,
Can we sort the data in aspose cells Java with more than 3 keys.
Currently DataSorter​ allows only 3 keys(setKey1​, setKey2, setKey3) maximum for sorting.​

Regards
Javith

@Javith,

Please use DataSorter.addKey() method to add as many keys as you want.