Browse Source

修复填充的时候,最后一行中间有空行会创建失败的bug

developing
Jiaju Zhuang 5 years ago
parent
commit
fdeb317940
  1. 8
      src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java

8
src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java

@ -303,7 +303,13 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
if (fillConfig.getForceNewRow()) { if (fillConfig.getForceNewRow()) {
row = cachedSheet.createRow(lastRowIndex); row = cachedSheet.createRow(lastRowIndex);
} else { } else {
row = sheet.createRow(lastRowIndex); // The last row of the middle disk inside empty rows, resulting in cachedSheet can not get inside.
// Will throw Attempting to write a row[" + rownum + "] " + "in the range [0," + this._sh.getLastRowNum() + "] that is already written to disk.
try{
row = sheet.createRow(lastRowIndex);
}catch (IllegalArgumentException ignore){
row = cachedSheet.createRow(lastRowIndex);
}
} }
checkRowHeight(analysisCell, fillConfig, isOriginalCell, row); checkRowHeight(analysisCell, fillConfig, isOriginalCell, row);
WriteHandlerUtils.afterRowCreate(writeContext, row, null, Boolean.FALSE); WriteHandlerUtils.afterRowCreate(writeContext, row, null, Boolean.FALSE);

Loading…
Cancel
Save