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

Free Support Forum - aspose.com

Date column not sorted correctly


I have an excel file with a date column for which sorting doesn’t work. I followed the example here when creating my own application.

When I open excel manually and click the sort button it works. When I programmatically change the format to numbers and sort it works. Therefore it seems to be connected to the formatting as date. It doesn’t matter which kind of date formatting (YYYY-MM-DD or DD.MM.YYYY) I use, the issue persists. My Excel version is 2013.

My code:

var workbook = new Workbook(Path.Combine(path, "LayoutTestData.xlsx"));

var sorter = workbook.DataSorter;

sorter.Order1 = SortOrder.Descending;
sorter.Key1 = 0;
sorter.Order2 = SortOrder.Ascending;
sorter.Key2 = 1;
var ca = new CellArea
                     StartRow = 0,
                     StartColumn = 0,
                     EndRow = 20,
                     EndColumn = 2
sorter.Sort(workbook.Worksheets[0].Cells, ca);

The file:
LayoutTestData.zip (6.9 KB)

Thank you for your support and best regards


Thanks for the template file and sample code.

After an initial test, I am able to reproduce the issue as you mentioned by using your sample code with your template file. I found that Date column is not sorted correctly as you pointed out.

I have logged a ticket with an id “CELLSNET-45688” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.


Thanks for using Aspose APIs.

This is to inform you that we have fixed your issue CELLSNET-45688 now. We will soon provide the fix after performing QA and including other enhancements and fixes.


Please try our latest version/fix: Aspose.Cells for .NET (Latest Version)

Your issue “CELLSNET-45688” should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-45688) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.