]> source.dussan.org Git - poi.git/commitdiff
[bug-66213] hack clone table code to avoid failing with edge cases
authorPJ Fanning <fanningpj@apache.org>
Sun, 14 Aug 2022 09:50:00 +0000 (09:50 +0000)
committerPJ Fanning <fanningpj@apache.org>
Sun, 14 Aug 2022 09:50:00 +0000 (09:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903410 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java

index b2b41ce7f89417754656e072511736b334ab3996..8efbfcf5574bbd276bbdbe532c9d7c2178ecb468 100644 (file)
@@ -4948,8 +4948,9 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx
                             int c = clonedTable.getStartCellReference().getCol() + i;
                             sheet.getWorkbook().setCellFormulaValidation(false);
                             for (int r = rFirst; r <= rLast; r++) {
-                                XSSFRow row = sheet.getRow(r); if (row == null) row = sheet.createRow(r);
-                                XSSFCell cell = row.getCell(c); if (cell == null) cell = row.createCell(c);
+                                XSSFRow row = sheet.getRow(r);
+                                if (row == null) row = sheet.createRow(r);
+                                XSSFCell cell = row.getCell(c, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
                                 cell.setCellFormula(clonedFormula);
                             }
                         }