Cell references to tables result in #REF errors after deleting columns

Hi, I’ve noticed an issue that occurs when deleting columns in a worksheet with cells that contain references to a table in that worksheet.

When the columns are deleted, any cell formulas that reference that table are changed to #REF and no longer evaluate. This was working in 20.7 but seems to result in #REF errors in 22.7 and 22.11. Deleting rows seems to work just fine.

Below is a minimal version of the code that replicates the issue in the affected versions. The expected output is that the second Assert should succeed and, if the workbook is saved/opened, the columns should be deleted and the cell with a table reference in its formula should be unchanged.

var wb = new Aspose.Cells.Workbook();
var ws = wb.Worksheets.First();
//Create a 2x2 table at F1:G2
ws.Cells[0, 5].PutValue("Column A");
ws.Cells[0, 6].PutValue("Column B");
ws.Cells[1, 5].PutValue("1");
ws.Cells[1, 6].PutValue("2");
var tableIdx = ws.ListObjects.Add(0, 5, 1, 6, true);
var tableDef = ws.ListObjects[tableIdx];

//create a reference to the table prior to deleting columns
ws.Cells[0, 7].Formula = $"=SUM({tableDef.DisplayName}[Column A])";
Assert.AreEqual($"=SUM({tableDef.DisplayName}[Column A])", ws.Cells[0, 7].Formula);

//Delete prior columns
ws.Cells.DeleteColumns(0, 4, true);

//This part fails as of 22.7 and 22.11 - formula is replaced with #REF instead of maintaining the table reference
Assert.AreEqual($"=SUM({tableDef.DisplayName}[Column A])", ws.Cells[0, 3].Formula);

@ryanmcarthur,

Thanks for the details and sample.

Please notice, I am able to reproduce the issue as you mentioned by using your sample code segment. I found cell references to tables result in #REF errors after deleting columns. I have logged a ticket with an id “CELLSNET-52387” for your issue. We will look into the details of the issue.

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

@ryanmcarthur,

This is to inform you that your issue has been resolved now. The fix will be included in our upcoming release (Aspose.Cells v22.12) which is scheduled in the first half of December 2022. You will be notified once the next release is published.

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