Excel (xls) loses custom sorting upon saving the file

Hello everyone,


I’m investigating an issue with Excel losing custom sorting when saving the file with Aspose.Cells. No need to make any edits, just save, and the custom sorting is lost.

The case is related to older Excel format XLS files only. This does not happen with newer XLSX format. As well another detail is that you must have more than 3 custom sorting rules set. Attached picture will help to understand.

When you set the sorting and save the file in Excel it does warn about possible loss of data, but when opening the file the sorting rules are still there. After saving the file with Aspose.Cells it will lose these sorting rules.

C# code:
///
/// Opens and saves the file without any modifications.
///
///
///
public static void OpenAndSave( string excelFile, string saveAsFile )
{
// Open the file.
Workbook excel = new Workbook( excelFile );

// Save as stamped file.
excel.Save( saveAsFile );
}

Attached couple images to illustrate what happens.

Hi,


Thanks for the screenshots and details.

Well, I think MS Excel 2003 only supports maximum of 3 custom data sorting rules for XLS file format. I guess you are seeing the data sorting rules (in tact) as you are opening the output XLS file into new versions e.g MS Excel 2013/2016. Because when you will even open the manual saved output XLS file (e.g just opened and re-saved your template file in MS Excel 2013/2016) into MS Excel 2003 or older version, you will not see these rules might be lost as well. Aspose.Cells follows MS Excel 2003 standards when manipulating XLS file format in most cases. Anyways, could you provide us your template XLS file and output XLS file here, we will check it and investigate if we could support your needs to figure out your issue.

Thank you.

Thanks for a quick response!


You are correct that older Excel format supports only 3 custom data sorting rules. Hence the warning message when saving to older format :smiley:

We explained this to our customer and they are looking if they can upgrade all their files to newer XLSX format. Which will solve the issue anyways.

In case you guys can look if there is anything to do, here are the files. One in XLSX format, same file saved as XLS format, and then the XLS saved through Aspose.Cells.

I hope this helps you to look into the case. Let me know if there is anything else I can provide to make it easier to look into.

Hi,


Thanks for your posting and using Aspose.Cells.

When we convert your Excel file into XLS format using MS-Excel 2016, custom sorting information is not lost but when we do it with Aspose.Cells, this information is lost.

Besides, we have checked this issue in MS-Excel 2003 (see the screenshot). If we save your Excel file into XLS format using Excel 2003 and then open it with MS-Excel 2016, custom sorting information is still not lost.

This issue has been logged as

  • CELLSNET-45424 - Custom Sorting is lost when saved to XLS by Aspose.Cells but it is not lost when saved to XLS by MS-Excel 2016

Hi,


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

Thank you.

Thank you very much for such a quick fix!

Hi,

Thanks for using Aspose.Cells.

Please download and try the following latest fix

Aspose.Cells for .NET v17.5.9 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.5.9 (.NET 4.0) compiled in .NET Framework 4.0.

and let us know your feedback.

Thank you for making this happen so quickly!


This updated version v17.5.9 (.NET4.0) seemed to work nicely. It did keep the custom sorting order in XLS file.

Hi,


Good to know that your issue is sorted out by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.

The issues you have found earlier (filed as CELLSNET-45424) have been fixed in Aspose.Cells for .NET 17.6.


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