diff --git a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java index ad38a056..388fc770 100644 --- a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java +++ b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java @@ -337,15 +337,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { } } if (analysisCell == null) { - analysisCell = new AnalysisCell(); - analysisCell.setRowIndex(rowIndex); - analysisCell.setColumnIndex(columnIndex); - analysisCell.setOnlyOneVariable(Boolean.TRUE); - List variableList = new ArrayList(); - analysisCell.setVariableList(variableList); - List prepareDataList = new ArrayList(); - analysisCell.setPrepareDataList(prepareDataList); - analysisCell.setCellType(WriteTemplateAnalysisCellTypeEnum.COMMON); + analysisCell = initAnalysisCell(rowIndex, columnIndex); } String variable = value.substring(prefixIndex + 1, suffixIndex); if (StringUtils.isEmpty(variable)) { @@ -385,6 +377,19 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { return false; } + private AnalysisCell initAnalysisCell(Integer rowIndex, Integer columnIndex) { + AnalysisCell analysisCell = new AnalysisCell(); + analysisCell.setRowIndex(rowIndex); + analysisCell.setColumnIndex(columnIndex); + analysisCell.setOnlyOneVariable(Boolean.TRUE); + List variableList = new ArrayList(); + analysisCell.setVariableList(variableList); + List prepareDataList = new ArrayList(); + analysisCell.setPrepareDataList(prepareDataList); + analysisCell.setCellType(WriteTemplateAnalysisCellTypeEnum.COMMON); + return analysisCell; + } + private String convertPrepareData(String prepareData) { prepareData = prepareData.replaceAll(ESCAPE_FILL_PREFIX, FILL_PREFIX); prepareData = prepareData.replaceAll(ESCAPE_FILL_SUFFIX, FILL_SUFFIX);