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

Free Support Forum - aspose.com

Range refersTo is incorrectly escaped

You can see the issue with the following code:

        var workbook = new Workbook();

        var worksheet = workbook.Worksheets.Add("Q're");
        var index = workbook.Worksheets.Names.Add("Test");
        var name = workbook.Worksheets.Names[index];

        var range = worksheet.Cells.CreateRange("A1:X1");
        name.RefersTo = range.RefersTo;

Refersto is “=‘Q’re’!$A$1:$X$1” and should be “=‘Q’‘re’!$A$1:$X$1”
Notice the escaped apostrophe.
oQu3Yk4mGC.png (17.7 KB)

VBA code:
Dim wb As Workbook
Dim ws As Worksheet
Dim n As Name
Dim refersTo As String
Dim r As Range

Set wb = ActiveWorkbook

Set ws = wb.Worksheets.Add()
ws.Name = "Q're"

Set n = wb.Names.Add("Test", "'Q''!A1")
Debug.Print n.refersTo

8Pb2qouhBv.png (7.0 KB)

We have reproduced this issue and logged it in our database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSNET-49827 - Range refersTo is incorrectly escaped


This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Please try our latest fix.
Aspose.Cells21.11.5 For .Net2_AuthenticodeSigned.Zip (5.6 MB)
Aspose.Cells21.11.5 For .Net4.0.Zip (5.6 MB)
Aspose.Cells21.11.5 For .NetStandard20.Zip (5.6 MB)

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