Browse Source

修复空数据未替换掉的bug

pull/732/head
Jiaju Zhuang 5 years ago
parent
commit
4f4d8acc7f
  1. 20
      src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java
  2. 2
      update.md

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

@ -279,7 +279,12 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
if (cell == null) {
continue;
}
boolean needFill =
prepareData(cell.getStringCellValue(), analysisCellList, collectionAnalysisCellList, i, j);
// Prevent empty data from not being replaced
if (needFill) {
cell.setCellValue(StringUtils.EMPTY);
}
}
}
templateAnalysisCache.put(sheetNo, analysisCellList);
@ -287,10 +292,19 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
return analysisCache.get(sheetNo);
}
private void prepareData(String value, List<AnalysisCell> analysisCellList,
/**
*
* @param value
* @param analysisCellList
* @param collectionAnalysisCellList
* @param rowIndex
* @param columnIndex
* @return Is a cell to be filled
*/
private boolean prepareData(String value, List<AnalysisCell> analysisCellList,
List<AnalysisCell> collectionAnalysisCellList, int rowIndex, int columnIndex) {
if (StringUtils.isEmpty(value)) {
return;
return false;
}
AnalysisCell analysisCell = null;
int startIndex = 0;
@ -365,7 +379,9 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
} else {
collectionAnalysisCellList.add(analysisCell);
}
return true;
}
return false;
}
private String convertPrepareData(String prepareData) {

2
update.md

@ -1,6 +1,6 @@
# 2.1.0-beta2
* 修改模板通过流创建报错的bug
*
* 修复空数据未替换掉的bug
# 2.1.0-beta1
* 新增支持导入、导出支持公式

Loading…
Cancel
Save