|
|
@ -295,8 +295,43 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { |
|
|
|
default: |
|
|
|
default: |
|
|
|
throw new ExcelGenerateException("The wrong direction."); |
|
|
|
throw new ExcelGenerateException("The wrong direction."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Row row = createRowIfNecessary(sheet, cachedSheet, lastRowIndex, fillConfig, analysisCell, isOriginalCell); |
|
|
|
|
|
|
|
Cell cell = createCellIfNecessary(row,lastColumnIndex); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<AnalysisCell, CellStyle> collectionFieldStyleMap = collectionFieldStyleCache.get(currentUniqueDataFlag); |
|
|
|
|
|
|
|
if (collectionFieldStyleMap == null) { |
|
|
|
|
|
|
|
collectionFieldStyleMap = new HashMap<AnalysisCell, CellStyle>(16); |
|
|
|
|
|
|
|
collectionFieldStyleCache.put(currentUniqueDataFlag, collectionFieldStyleMap); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isOriginalCell) { |
|
|
|
|
|
|
|
collectionFieldStyleMap.put(analysisCell, cell.getCellStyle()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
CellStyle cellStyle = collectionFieldStyleMap.get(analysisCell); |
|
|
|
|
|
|
|
if (cellStyle != null) { |
|
|
|
|
|
|
|
cell.setCellStyle(cellStyle); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return cell; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Cell createCellIfNecessary(Row row, Integer lastColumnIndex) { |
|
|
|
|
|
|
|
Cell cell = row.getCell(lastColumnIndex); |
|
|
|
|
|
|
|
if (cell != null) { |
|
|
|
|
|
|
|
return cell; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
WriteHandlerUtils.beforeCellCreate(writeContext, row, null, lastColumnIndex, null, Boolean.FALSE); |
|
|
|
|
|
|
|
cell = row.createCell(lastColumnIndex); |
|
|
|
|
|
|
|
WriteHandlerUtils.afterCellCreate(writeContext, cell, null, null, Boolean.FALSE); |
|
|
|
|
|
|
|
return cell; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Row createRowIfNecessary(Sheet sheet, Sheet cachedSheet, Integer lastRowIndex, FillConfig fillConfig, |
|
|
|
|
|
|
|
AnalysisCell analysisCell, boolean isOriginalCell) { |
|
|
|
Row row = sheet.getRow(lastRowIndex); |
|
|
|
Row row = sheet.getRow(lastRowIndex); |
|
|
|
if (row == null) { |
|
|
|
if (row != null) { |
|
|
|
|
|
|
|
return row; |
|
|
|
|
|
|
|
} |
|
|
|
row = cachedSheet.getRow(lastRowIndex); |
|
|
|
row = cachedSheet.getRow(lastRowIndex); |
|
|
|
if (row == null) { |
|
|
|
if (row == null) { |
|
|
|
WriteHandlerUtils.beforeRowCreate(writeContext, lastRowIndex, null, Boolean.FALSE); |
|
|
|
WriteHandlerUtils.beforeRowCreate(writeContext, lastRowIndex, null, Boolean.FALSE); |
|
|
@ -316,28 +351,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
checkRowHeight(analysisCell, fillConfig, isOriginalCell, row); |
|
|
|
checkRowHeight(analysisCell, fillConfig, isOriginalCell, row); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return row; |
|
|
|
Cell cell = row.getCell(lastColumnIndex); |
|
|
|
|
|
|
|
if (cell == null) { |
|
|
|
|
|
|
|
WriteHandlerUtils.beforeCellCreate(writeContext, row, null, lastColumnIndex, null, Boolean.FALSE); |
|
|
|
|
|
|
|
cell = row.createCell(lastColumnIndex); |
|
|
|
|
|
|
|
WriteHandlerUtils.afterCellCreate(writeContext, cell, null, null, Boolean.FALSE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<AnalysisCell, CellStyle> collectionFieldStyleMap = collectionFieldStyleCache.get(currentUniqueDataFlag); |
|
|
|
|
|
|
|
if (collectionFieldStyleMap == null) { |
|
|
|
|
|
|
|
collectionFieldStyleMap = new HashMap<AnalysisCell, CellStyle>(16); |
|
|
|
|
|
|
|
collectionFieldStyleCache.put(currentUniqueDataFlag, collectionFieldStyleMap); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isOriginalCell) { |
|
|
|
|
|
|
|
collectionFieldStyleMap.put(analysisCell, cell.getCellStyle()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
CellStyle cellStyle = collectionFieldStyleMap.get(analysisCell); |
|
|
|
|
|
|
|
if (cellStyle != null) { |
|
|
|
|
|
|
|
cell.setCellStyle(cellStyle); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return cell; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void checkRowHeight(AnalysisCell analysisCell, FillConfig fillConfig, boolean isOriginalCell, Row row) { |
|
|
|
private void checkRowHeight(AnalysisCell analysisCell, FillConfig fillConfig, boolean isOriginalCell, Row row) { |
|
|
|