JanKallman / EPPlus

Create advanced Excel spreadsheets using .NET
3.75k stars 1.17k forks source link

InsertColumns updates Comment cell address but does not reparent the comment #596

Open Prinsn opened 4 years ago

Prinsn commented 4 years ago

Inserting a column appears to parent comment objects to the new column while updating the cell address to the new column.

This leads to an inability to delete the comment by address, or delete the column.

            ws.Cells["A1"].AddComment("na", "test");
            ws.InsertColumn(1, 1);
            Log(ws.Cells["A1"].Comment.Address); // => "B1"

            //Throws a null reference exception
            ws.Comments.Remove(ws.Cells["B1"].Comment);

            //Throws an exception "Comment does not exist"
            ws.DeleteColumn(2);