Browse Source

Merge pull request #2036 from duanqiaoyanyu/bugfix

fix issue 2035
developing
Jiaju Zhuang 3 years ago committed by GitHub
parent
commit
111d6e0a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java

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

@ -416,6 +416,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
int startIndex = 0;
int length = value.length();
int lastPrepareDataIndex = 0;
int variableCount = 0;
out:
while (startIndex < length) {
int prefixIndex = value.indexOf(FILL_PREFIX, startIndex);
@ -447,7 +448,10 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
String variable = value.substring(prefixIndex + 1, suffixIndex);
if (StringUtils.isEmpty(variable)) {
continue;
} else {
++variableCount;
}
int collectPrefixIndex = variable.indexOf(COLLECTION_PREFIX);
if (collectPrefixIndex > -1) {
if (collectPrefixIndex != 0) {
@ -466,10 +470,14 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
String data = convertPrepareData(value.substring(lastPrepareDataIndex, prefixIndex));
preparedData.append(data);
analysisCell.getPrepareDataList().add(data);
analysisCell.setOnlyOneVariable(Boolean.FALSE);
}
lastPrepareDataIndex = suffixIndex + 1;
}
if (variableCount > 1) {
analysisCell.setOnlyOneVariable(Boolean.FALSE);
}
return dealAnalysisCell(analysisCell, value, rowIndex, lastPrepareDataIndex, length, firstRowCache,
preparedData);
}

Loading…
Cancel
Save