|
|
@ -161,14 +161,10 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
.setCachedSheet(writeWorkbookHolder.getCachedWorkbook().getSheet(writeSheetHolder.getSheetName())); |
|
|
|
.setCachedSheet(writeWorkbookHolder.getCachedWorkbook().getSheet(writeSheetHolder.getSheetName())); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
if (LOGGER.isDebugEnabled()) { |
|
|
|
currentSheet = createSheet(); |
|
|
|
LOGGER.debug("Can not find sheet:{} ,now create it", writeSheetHolder.getSheetNo()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(writeSheetHolder.getSheetName())) { |
|
|
|
|
|
|
|
writeSheetHolder.setSheetName(writeSheetHolder.getSheetNo().toString()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
currentSheet = WorkBookUtil.createSheet(writeWorkbookHolder.getWorkbook(), writeSheetHolder.getSheetName()); |
|
|
|
if (currentSheet == null) { |
|
|
|
writeSheetHolder.setCachedSheet(currentSheet); |
|
|
|
currentSheet = createSheet(); |
|
|
|
} |
|
|
|
} |
|
|
|
writeSheetHolder.setSheet(currentSheet); |
|
|
|
writeSheetHolder.setSheet(currentSheet); |
|
|
|
WriteHandlerUtils.afterSheetCreate(this); |
|
|
|
WriteHandlerUtils.afterSheetCreate(this); |
|
|
@ -180,6 +176,19 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
writeWorkbookHolder.getHasBeenInitializedSheetNameMap().put(writeSheetHolder.getSheetName(), writeSheetHolder); |
|
|
|
writeWorkbookHolder.getHasBeenInitializedSheetNameMap().put(writeSheetHolder.getSheetName(), writeSheetHolder); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Sheet createSheet() { |
|
|
|
|
|
|
|
if (LOGGER.isDebugEnabled()) { |
|
|
|
|
|
|
|
LOGGER.debug("Can not find sheet:{} ,now create it", writeSheetHolder.getSheetNo()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(writeSheetHolder.getSheetName())) { |
|
|
|
|
|
|
|
writeSheetHolder.setSheetName(writeSheetHolder.getSheetNo().toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Sheet currentSheet = |
|
|
|
|
|
|
|
WorkBookUtil.createSheet(writeWorkbookHolder.getWorkbook(), writeSheetHolder.getSheetName()); |
|
|
|
|
|
|
|
writeSheetHolder.setCachedSheet(currentSheet); |
|
|
|
|
|
|
|
return currentSheet; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void initHead(ExcelWriteHeadProperty excelWriteHeadProperty) { |
|
|
|
public void initHead(ExcelWriteHeadProperty excelWriteHeadProperty) { |
|
|
|
if (!currentWriteHolder.needHead() || !currentWriteHolder.excelWriteHeadProperty().hasHead()) { |
|
|
|
if (!currentWriteHolder.needHead() || !currentWriteHolder.excelWriteHeadProperty().hasHead()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|