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

Free Support Forum - aspose.com

Can't read template excel's sorting settings

Hi there,


The company I work for is about to purchase licenses to use Aspose.Cells in our development projects.
We are wondering if there is a way to read a template excel’s sort settings so we could refresh sorts using this.

I have look in the other threads in this forum and found a thread on above suggests that this has been considered, but I was wondering if its in queue for work or in progress.

I have attached our template file that has a table with a sort order.

Thank you,
Hi,

Thanks for the template file.

After an initial test, I can notice the issue by using the following sample code with your template file.


Sample code:

Workbook workbook = new Workbook("e:\\test2\\Templateexcel3Rowsplu+formula2.xlsx");
ListObject listObject = workbook.Worksheets[0].ListObjects[0];
listObject.AutoFilter.Refresh();
DataSorter sorter = listObject.AutoFilter.Sorter;
MessageBox.Show(sorter.Order1.ToString()); //Ascending
MessageBox.Show(sorter.Order2.ToString());

I have logged a ticket with an id "CELLSNET-41474" for your issue. We will check your issue soon.
Once we have any update on it, we will let you know here.

Thank you.

Thank you for confirming the issue, we will just wait for a solution.

Thank you.

Hi,


Please try the attached fix/version: Aspose.Cells for .NET v7.4.1.4.

We have fixed your issue now.

Thank you.

Hi,


That fixed the issue, however it’s not 100%.

I have have tried to sort the ListObjects using the following:

foreach(Worksheet sheet in wb.Worksheets)
{
foreach (Aspose.Cells.Tables.ListObject lo in sheet.ListObjects)
{
lo.AutoFilter.Sorter.Sort();
}
}

This successfully sorts the ListObjects, However, when you try to change the generated excel file’s sort settings, the sort arrows are not updated unless, you save -> close -> reopen the file.

Thank you.

Hi,


Could you add the line to your code, e.g


foreach(Worksheet sheet in wb.Worksheets)
{
foreach (Aspose.Cells.Tables.ListObject lo in sheet.ListObjects)
{
lo.AutoFilter.Sorter.Sort();
lo.AutoFilter.Refresh();
}
}


If you still find the issue, kindly create a sample console application, zip it and post it here, we will check it soon. Also, attach your template Excel files and some screen shots to show the issue.

Thank you.