From 39ed3a6738a52f512f97594482a031977c87b60b Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Fri, 22 May 2020 17:25:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E4=B8=AA`sheet`?= =?UTF-8?q?=E4=B8=8D=E6=8C=89=E7=85=A7=E9=A1=BA=E5=BA=8F=E5=86=99=E5=85=A5?= =?UTF-8?q?=20=E4=BC=9A=E4=B9=B1=E5=BA=8F=E7=9A=84bug=20#1332?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/alibaba/excel/context/WriteContextImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/alibaba/excel/context/WriteContextImpl.java b/src/main/java/com/alibaba/excel/context/WriteContextImpl.java index cec99f5..86ecc20 100644 --- a/src/main/java/com/alibaba/excel/context/WriteContextImpl.java +++ b/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