From 60f7ab19298305b2bf288e2a160e823e391597d8 Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Tue, 22 Oct 2019 23:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E4=BC=9A=E7=A9=BA=E4=B8=80=E8=A1=8C=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../executor/ExcelWriteFillExecutor.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) 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 ad38a05..388fc77 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);