Browse Source

合并冲突 修改原来的写法

developing
huaiyu 5 years ago
parent
commit
4f9bcc7073
  1. 10
      src/main/java/com/alibaba/excel/write/ExcelBuilderImpl.java
  2. 8
      src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java

10
src/main/java/com/alibaba/excel/write/ExcelBuilderImpl.java

@ -98,10 +98,16 @@ public class ExcelBuilderImpl implements ExcelBuilder {
@Override @Override
public void addContent(List data, WriteSheet writeSheet, WriteTable writeTable, String password) { public void addContent(List data, WriteSheet writeSheet, WriteTable writeTable, String password) {
try { try {
context.currentSheet(writeSheet); if (data == null) {
return;
}
context.currentSheet(writeSheet, WriteTypeEnum.ADD);
context.currentTable(writeTable); context.currentTable(writeTable);
context.setPassword(password); context.setPassword(password);
doAddContent(data); if (excelWriteAddExecutor == null) {
excelWriteAddExecutor = new ExcelWriteAddExecutor(context);
}
excelWriteAddExecutor.add(data);
} catch (RuntimeException e) { } catch (RuntimeException e) {
finish(); finish();
throw e; throw e;

8
src/main/java/com/alibaba/excel/write/metadata/holder/WriteWorkbookHolder.java

@ -261,4 +261,12 @@ public class WriteWorkbookHolder extends AbstractWriteHolder {
public HolderEnum holderType() { public HolderEnum holderType() {
return HolderEnum.WORKBOOK; return HolderEnum.WORKBOOK;
} }
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
} }

Loading…
Cancel
Save