Skip to content

Commit

Permalink
XLS - Fix adding cell comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Bykiev committed Mar 31, 2024
1 parent 462f15f commit c0378c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 1 addition & 4 deletions main/HSSF/Record/EscherAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1298,10 +1298,7 @@ public void RemoveTailRecord(NoteRecord note)

internal void AddTailRecord(NoteRecord note)
{
if (tailRec.ContainsKey(note.ShapeId))
tailRec.Add(note.ShapeId, note);
else
tailRec[note.ShapeId] = note;
tailRec[note.ShapeId] = note;
}
/**
* @return unmodifiable copy of tail records. We need to access them when building shapes.
Expand Down
15 changes: 15 additions & 0 deletions testcases/main/HSSF/UserModel/TestHSSFComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,5 +452,20 @@ public void ShapeId()

wb.Close();
}

[Test]
public void TestBug1240()
{
using(var wb = HSSFTestDataSamples.OpenSampleWorkbook("test_FailAddingComment.xls"))
{
Assert.DoesNotThrow(() =>
{
ISheet sheet = wb.GetSheetAt(0);
var drawingPatriarch2 = sheet.CreateDrawingPatriarch();
IClientAnchor anchor2 = drawingPatriarch2.CreateAnchor(0, 0, 0, 0, 55, 71, 58, 75);
IComment comment2 = drawingPatriarch2.CreateCellComment(anchor2);
});
}
}
}
}
Binary file not shown.

0 comments on commit c0378c6

Please sign in to comment.