-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Range object's address is not updated after inserting cells #473
Comments
No, the range is no updated when inserting or deleting in a range. As this is the current behavior we can't really change it, but we will look at returning the inserted/deleted range from the methods instead, as they are of declared void as of today. [TestMethod]
public void CheckRangeAddressAfterInsertingCells()
{
using (var pck = new ExcelPackage())
{
// Create a worksheet
var wks = pck.Workbook.Worksheets.Add("Sheet1");
// Get a range
var rng = wks.Cells["B3:B5"];
Assert.AreEqual("B3:B5", rng.LocalAddress);
// Insert cells to the left
var insertedRng = rng.Insert(eShiftTypeInsert.Right);
// Check the range has shifted right
Assert.AreEqual("C3:C5", insertedRng.LocalAddress);
}
} |
OK - that wouldn't technically be the inserted range that you're returning though. The It would make more sense for the inserted range to be returned and |
Yes, insertedRng will be set to the range updated after the insert or delete operation. rng will still point to B3:B5. Otherwise we will have a breaking change. |
Same effect applies when defining a ExcelNamedRange and then inserting a full row before that using This is a breaking change compared to v5.6.4 which I used previously. |
Is there any ETA on this? |
If I have a range that refers to
B3
, and then I insert cells, I expect that the range is updated to eitherC3
(if shifting right) orB4
(if shifting down). But the range object just stays pointing atB3
.Is that expected behaviour? It's different to how it works in VBA/Interop so just wanted to check whether this was intentional.
The text was updated successfully, but these errors were encountered: