Browse Source

修复多个`sheet`不按照顺序写入 会乱序的bug #1332

pull/1391/head
Jiaju Zhuang 5 years ago
parent
commit
39ed3a6738
  1. 6
      src/main/java/com/alibaba/excel/context/WriteContextImpl.java

6
src/main/java/com/alibaba/excel/context/WriteContextImpl.java

@ -163,14 +163,14 @@ public class WriteContextImpl implements WriteContext {
Sheet currentSheet;
try {
if (writeSheetHolder.getSheetNo() != null) {
int realSheetNo = writeSheetHolder.getSheetNo();
// When the add default sort order of appearance
if (WriteTypeEnum.ADD.equals(writeType)) {
currentSheet = createSheet();
} else {
currentSheet = writeWorkbookHolder.getWorkbook().getSheetAt(realSheetNo);
currentSheet = writeWorkbookHolder.getWorkbook().getSheetAt(writeSheetHolder.getSheetNo());
writeSheetHolder
.setCachedSheet(writeWorkbookHolder.getCachedWorkbook().getSheetAt(realSheetNo));
.setCachedSheet(
writeWorkbookHolder.getCachedWorkbook().getSheetAt(writeSheetHolder.getSheetNo()));
}
} else {
// sheet name must not null

Loading…
Cancel
Save