further issue with clone

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903400 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-08-13 20:05:34 +00:00
parent 6d2853d9bd
commit 6f6e1c4165
1 changed files with 6 additions and 1 deletions

View File

@ -4938,7 +4938,12 @@ 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++) {
sheet.getRow(r).getCell(c).setCellFormula(clonedFormula);
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);
}
}
}