fix broken test

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895211 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-11-20 16:50:15 +00:00
parent 3d44f76500
commit 537ddf53b9
1 changed files with 9 additions and 7 deletions

View File

@ -3051,19 +3051,21 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
// also remove any comments associated with this row // also remove any comments associated with this row
if (sheetComments != null) { if (sheetComments != null) {
ArrayList<CellAddress> refsToRemove = new ArrayList<>();
Iterator<CellAddress> commentAddressIterator = sheetComments.getCellAddresses(); Iterator<CellAddress> commentAddressIterator = sheetComments.getCellAddresses();
while (commentAddressIterator.hasNext()) { while (commentAddressIterator.hasNext()) {
CellAddress ref = commentAddressIterator.next(); CellAddress ref = commentAddressIterator.next();
// is this comment part of the current row? // is this comment part of the current row?
if(rowsToRemoveSet.contains(ref.getRow())) { if(rowsToRemoveSet.contains(ref.getRow())) {
refsToRemove.add(ref);
}
}
for (CellAddress ref : refsToRemove) {
sheetComments.removeComment(ref); sheetComments.removeComment(ref);
if (vml != null) { if (vml != null) {
vml.removeCommentShape(ref.getRow(), ref.getColumn()); vml.removeCommentShape(ref.getRow(), ref.getColumn());
} }
} }
}
} }
// also remove any hyperlinks associated with this row // also remove any hyperlinks associated with this row