Skip to content
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

XLS - Fix adding cell comment #1303

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading