When deleting a range using DeleteRange, cells on other sheets do not update references to reflect the changes. There is no parameter on the method to update references like it exists on DeleteCells.
Below is a fully functional code to demonstrate this issue. I have attached a file called book1.xlsm.
using System.IO;
using Aspose.Cells;
namespace AsposeTest
{
class Program
{
static void Main(string[] args)
{
string template = @“c:\delete\book1.xlsm”;
string outputFile = @“c:\delete\out.xlsm”;
File.Copy(template, outputFile, true);
Workbook document = new Workbook(outputFile);
Worksheet w = document.Worksheets[“Sheet2”];
w.Cells.DeleteRange(1, 1, 5, 6, ShiftType.Up);
document.Save(outputFile);
}
}
}
Hi,
Thanks for your posting and using Aspose.Cells for .NET.
We were able to observe this issue using the given code with the latest version:
Aspose.Cells
for .NET v7.3.2.1
We found, references are not updated which should be fixed.
We have logged this issue in our database, we will look into it and fix the issue. Once the issue is fixed or we have some other update for you, we will let you know asap.
This issue has been logged as CELLSNET-41110.
I have attached the output xlsm file and screenshot for your reference
C#
string template = @“F:\Shak-Data-RW\Downloads\Book1.xlsm”;
string outputFile = @“F:\Shak-Data-RW\Downloads\Book1.xlsm.out.xlsm”;
File.Copy(template, outputFile, true);
Workbook document = new Workbook(outputFile);
Worksheet w = document.Worksheets[“Sheet2”];
w.Cells.DeleteRange(1, 1, 5, 6, ShiftType.Up);
document.CalculateFormula();
document.Save(outputFile);
Screenshot:
Thanks a lot for the quick reply.
One more thing to noe is that not only the variable was not updated as you point out on your screenshot. Also the cell address in the formula is not updated.
After the shift up, B9 should have changed to =Sheet2!D2+Sheet2!D4
Hi,
Thanks for your screenshot.
We have also noticed this issue.
We have logged your screenshot and issue description in our database against the issue id: CELLSNET-41110
Once, there is some update for you, we will let you know asap.
Hi,
We have fixed this issue.
Please download and try this fix: Aspose.Cells for .NET v7.3.2.2 and let us know your feedback.
Hi,
We are afraid, this issue is not fixed fully.
We have reopened this issue and logged the new comments against this issue.
We have also recreated an expected output file and the screenshot for a reference so that this issue could be fixed fully.
Screenshot:
Hi,
Please try this fix/version: Aspose.Cells for .NET v7.3.2.3
We have updated the Name.RefersTo when deleting a range.
Thank you.
The issues you have found earlier (filed as CELLSNET-41110) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.