diff --git a/src/main/java/com/alibaba/excel/context/WriteContextImpl.java b/src/main/java/com/alibaba/excel/context/WriteContextImpl.java index 8e50eb74..24045101 100644 --- a/src/main/java/com/alibaba/excel/context/WriteContextImpl.java +++ b/src/main/java/com/alibaba/excel/context/WriteContextImpl.java @@ -179,12 +179,9 @@ public class WriteContextImpl implements WriteContext { writeSheetHolder .setCachedSheet(writeWorkbookHolder.getCachedWorkbook().getSheet(writeSheetHolder.getSheetName())); } - } catch (IllegalArgumentException e) { - if (e.getMessage() != null && e.getMessage().contains(NO_SHEETS)) { - currentSheet = createSheet(); - } else { - throw e; - } + } catch (Exception e) { + LOGGER.error("initSheet exception ",e); + currentSheet = createSheet(); } if (currentSheet == null) { currentSheet = createSheet();