Browse Source

重写主流程,代码更加优雅 测试完毕

2.1.x
Jiaju Zhuang 5 years ago
parent
commit
c88a082035
  1. 2
      src/main/java/com/alibaba/excel/context/AnalysisContext.java
  2. 2
      src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java
  3. 3
      src/main/java/com/alibaba/excel/write/executor/ExcelWriteFillExecutor.java

2
src/main/java/com/alibaba/excel/context/AnalysisContext.java

@ -88,7 +88,7 @@ public interface AnalysisContext {
/** /**
* Data that the customer needs to read * Data that the customer needs to read
* *
* @return * @param readSheetList
*/ */
void readSheetList(List<ReadSheet> readSheetList); void readSheetList(List<ReadSheet> readSheetList);

2
src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java

@ -37,7 +37,7 @@ public class ExcelWriteAddExecutor extends AbstractExcelWriteExecutor {
public void add(List data) { public void add(List data) {
if (CollectionUtils.isEmpty(data)) { if (CollectionUtils.isEmpty(data)) {
return; data = new ArrayList();
} }
WriteSheetHolder writeSheetHolder = writeContext.writeSheetHolder(); WriteSheetHolder writeSheetHolder = writeContext.writeSheetHolder();
int newRowIndex = writeSheetHolder.getNewRowIndexAndStartDoWrite(); int newRowIndex = writeSheetHolder.getNewRowIndexAndStartDoWrite();

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

@ -84,6 +84,9 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor {
} }
public void fill(Object data, FillConfig fillConfig) { public void fill(Object data, FillConfig fillConfig) {
if (data == null) {
data = new HashMap<String,Object>(16);
}
if (fillConfig == null) { if (fillConfig == null) {
fillConfig = FillConfig.builder().build(true); fillConfig = FillConfig.builder().build(true);
} }

Loading…
Cancel
Save