Free Support Forum - aspose.com

Named range and SortNames issue

Hi,

You made a fix a few days ago about an issue concerning the function "SortNames" (post #104342, fix: Aspose.cells.dll v4.4.0.20). But I have detect a new issue with this function. I attach two workbooks, "source" and "result" in order to explain the issue.
In the source workbook there are named ranges wich are used in some formulas. I open the source workbook, then I add some named ranges, and after I use SortNames and I save the workbook.
This is the sample code:
Workbook workbook;
workbook = new Workbook();
workbook.Open(filepath);

Worksheet worksheet = workbook.Worksheets[worksheet_codename];

Cell cell1 = worksheet.Cells[2, 6];
Range range1 = worksheet.Cells.CreateRange(cell1.Row, cell1.Column, 1, 1);
range1.Name = "ASCell1";

Cell cell2 = worksheet.Cells[1, 6];
Range range2 = worksheet.Cells.CreateRange(cell2.Row, cell2.Column, 1, 1);
range2.Name = "ASCell2";

workbook.Worksheets.SortNames();
workbook.Save(filepath);

When I check the workbook in excel, I notice that in worksheet 2, column D there are mistakes in some formulas which use named ranges. There is a shift in the named ranges (cells D5:D8 are good, cells D9:D14 are wrong).

The workbook named "source" shows the workbook before the operation, and the workbook "result" shows the workbook after the sample code is played.

Please, can you fix this issue, it is very important for us.

Thank you,

Gregory

Hi Gregory,

Thanks for the source and result files.

We checked and found the issue with Worksheets.SortNames method.

We will fix the issue soon.

Thank you.

Please try this attached fix.