Formulas are not being saved correctly when a workbook has external links to a workbook that has not been saved

PFA workbook: ExternalLinks.zip (7.1 KB)

In cells A1:A3, there are formulas that link to an external workbook that has not been saved (Book3):

In Aspose, these external links are not properly escaped with single quotes as in the Excel version:

When trying to set the same formula to another cells an error occurs because it is not properly escaped with single quotes (worksheets have spaces in them)

Source code I used with attached workbook:

        using (var workbook =
               new Workbook(
                   @"ExternalLinks.xlsx"))
        {
            var worksheet = workbook.Worksheets[0];

            var formula1 = worksheet.Cells["A1"].Formula;
            var formula2 = worksheet.Cells["A2"].Formula;
            var formula3 = worksheet.Cells["A3"].Formula;

            worksheet.Cells["B1"].Formula = formula1;
            worksheet.Cells["B2"].Formula = formula2;
            worksheet.Cells["B3"].Formula = formula3;
        }

The error returned is:
“Unknown token with bracket: 13(Based on cell Sheet1!B2)”

Thanks,
Dean

@Moonglum,

Please notice, after an initial test, I am able to reproduce the issue as you mentioned by using your template file. I got an exception “Unknown token with bracket: …” when resetting the formula back. It looks formulas are not escaped or not retrieved/saved properly. I have logged a ticket with an id “CELLSNET-50759” for your issue. We will look into it soon.

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

1 Like

@Moonglum,

This is to inform you that your issue has been resolved now. This fix will be included in the next release (Aspose.Cells for .NET v22.4) which is scheduled in the first half of April 2022. You will also be notified when the next version is released.

The issues you have found earlier (filed as CELLSNET-50759) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi