diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-02-02 21:13:32 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-02-02 21:13:32 +0000 |
commit | d7eb8e949ab4c4a77c095af024900704387ad878 (patch) | |
tree | 0ba1074e58372d6710e330f8bc53d77be04f784a /src/ooxml/testcases/org/apache/poi | |
parent | 7a0cc6e7e58f49c28b129057d03daf7ac33c4334 (diff) | |
download | poi-d7eb8e949ab4c4a77c095af024900704387ad878.tar.gz poi-d7eb8e949ab4c4a77c095af024900704387ad878.zip |
[bug-65120] PartAlreadyExistsException when creating cell comments (after some comments removed). Thanks to Raúl Wegmann
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1886143 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi')
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java index 2071ca7962..1ca51d3dcc 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java @@ -1887,7 +1887,7 @@ public final class TestXSSFSheet extends BaseTestXSheet { */ @Test void testInsertCommentsToClonedSheet() throws IOException { - try (Workbook wb = XSSFTestDataSamples.openSampleWorkbook("52425.xlsx")) { + try (Workbook wb = XSSFTestDataSamples.openSampleWorkbook("52425.xlsx")) { CreationHelper helper = wb.getCreationHelper(); Sheet sheet2 = wb.createSheet("Sheet 2"); Sheet sheet3 = wb.cloneSheet(0); @@ -1995,4 +1995,29 @@ public final class TestXSSFSheet extends BaseTestXSheet { } } } + + @Test + public void bug65120() throws IOException { + XSSFWorkbook wb = new XSSFWorkbook(); + CreationHelper creationHelper = wb.getCreationHelper(); + + Sheet sheet1 = wb.createSheet(); + Cell cell1 = sheet1.createRow(0).createCell(0); + Comment comment1 = sheet1.createDrawingPatriarch().createCellComment(creationHelper.createClientAnchor()); + cell1.setCellComment(comment1); + + Sheet sheet2 = wb.createSheet(); + Cell cell2 = sheet2.createRow(0).createCell(0); + Comment comment2 = sheet2.createDrawingPatriarch().createCellComment(creationHelper.createClientAnchor()); + cell2.setCellComment(comment2); + + wb.removeSheetAt(0); + + Sheet sheet3 = wb.createSheet(); + Cell cell3 = sheet3.createRow(0).createCell(0); + Comment comment3 = sheet3.createDrawingPatriarch().createCellComment(creationHelper.createClientAnchor()); + cell3.setCellComment(comment3); + + wb.close(); + } } |