Skip to content

Commit

Permalink
修复多个sheet不按照顺序写入 会乱序的bug #1332
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuangjiaju committed May 22, 2020
1 parent 39b0239 commit 39ed3a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/alibaba/excel/context/WriteContextImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ private void initSheet(WriteTypeEnum writeType) {
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
Expand Down

0 comments on commit 39ed3a6

Please sign in to comment.