|
|
@ -83,7 +83,7 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
} |
|
|
|
} |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
if (writeHandler instanceof WorkbookWriteHandler) { |
|
|
|
if (writeHandler instanceof WorkbookWriteHandler) { |
|
|
|
((WorkbookWriteHandler)writeHandler).beforeWorkbookCreate(); |
|
|
|
((WorkbookWriteHandler) writeHandler).beforeWorkbookCreate(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -95,7 +95,7 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
} |
|
|
|
} |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
if (writeHandler instanceof WorkbookWriteHandler) { |
|
|
|
if (writeHandler instanceof WorkbookWriteHandler) { |
|
|
|
((WorkbookWriteHandler)writeHandler).afterWorkbookCreate(writeWorkbookHolder); |
|
|
|
((WorkbookWriteHandler) writeHandler).afterWorkbookCreate(writeWorkbookHolder); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -149,7 +149,7 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
} |
|
|
|
} |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
if (writeHandler instanceof SheetWriteHandler) { |
|
|
|
if (writeHandler instanceof SheetWriteHandler) { |
|
|
|
((SheetWriteHandler)writeHandler).beforeSheetCreate(writeWorkbookHolder, writeSheetHolder); |
|
|
|
((SheetWriteHandler) writeHandler).beforeSheetCreate(writeWorkbookHolder, writeSheetHolder); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -161,7 +161,7 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
} |
|
|
|
} |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
if (writeHandler instanceof SheetWriteHandler) { |
|
|
|
if (writeHandler instanceof SheetWriteHandler) { |
|
|
|
((SheetWriteHandler)writeHandler).afterSheetCreate(writeWorkbookHolder, writeSheetHolder); |
|
|
|
((SheetWriteHandler) writeHandler).afterSheetCreate(writeWorkbookHolder, writeSheetHolder); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (null != writeWorkbookHolder.getWriteWorkbook().getWriteHandler()) { |
|
|
|
if (null != writeWorkbookHolder.getWriteWorkbook().getWriteHandler()) { |
|
|
@ -204,7 +204,7 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
// Combined head
|
|
|
|
// Combined head
|
|
|
|
addMergedRegionToCurrentSheet(excelWriteHeadProperty, newRowIndex); |
|
|
|
addMergedRegionToCurrentSheet(excelWriteHeadProperty, newRowIndex); |
|
|
|
for (int relativeRowIndex = 0, i = newRowIndex; i < excelWriteHeadProperty.getHeadRowNumber() + newRowIndex; |
|
|
|
for (int relativeRowIndex = 0, i = newRowIndex; i < excelWriteHeadProperty.getHeadRowNumber() + newRowIndex; |
|
|
|
i++, relativeRowIndex++) { |
|
|
|
i++, relativeRowIndex++) { |
|
|
|
beforeRowCreate(newRowIndex, relativeRowIndex); |
|
|
|
beforeRowCreate(newRowIndex, relativeRowIndex); |
|
|
|
Row row = WorkBookUtil.createRow(writeSheetHolder.getSheet(), i); |
|
|
|
Row row = WorkBookUtil.createRow(writeSheetHolder.getSheet(), i); |
|
|
|
afterRowCreate(row, relativeRowIndex); |
|
|
|
afterRowCreate(row, relativeRowIndex); |
|
|
@ -219,7 +219,7 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
} |
|
|
|
} |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
if (writeHandler instanceof RowWriteHandler) { |
|
|
|
if (writeHandler instanceof RowWriteHandler) { |
|
|
|
((RowWriteHandler)writeHandler).beforeRowCreate(writeSheetHolder, writeTableHolder, rowIndex, |
|
|
|
((RowWriteHandler) writeHandler).beforeRowCreate(writeSheetHolder, writeTableHolder, rowIndex, |
|
|
|
relativeRowIndex, true); |
|
|
|
relativeRowIndex, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -232,7 +232,7 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
} |
|
|
|
} |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
if (writeHandler instanceof RowWriteHandler) { |
|
|
|
if (writeHandler instanceof RowWriteHandler) { |
|
|
|
((RowWriteHandler)writeHandler).afterRowCreate(writeSheetHolder, writeTableHolder, row, |
|
|
|
((RowWriteHandler) writeHandler).afterRowCreate(writeSheetHolder, writeTableHolder, row, |
|
|
|
relativeRowIndex, true); |
|
|
|
relativeRowIndex, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -264,7 +264,7 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
} |
|
|
|
} |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
if (writeHandler instanceof CellWriteHandler) { |
|
|
|
if (writeHandler instanceof CellWriteHandler) { |
|
|
|
((CellWriteHandler)writeHandler).beforeCellCreate(writeSheetHolder, writeTableHolder, row, head, |
|
|
|
((CellWriteHandler) writeHandler).beforeCellCreate(writeSheetHolder, writeTableHolder, row, head, |
|
|
|
relativeRowIndex, true); |
|
|
|
relativeRowIndex, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -277,7 +277,7 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
} |
|
|
|
} |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
for (WriteHandler writeHandler : handlerList) { |
|
|
|
if (writeHandler instanceof CellWriteHandler) { |
|
|
|
if (writeHandler instanceof CellWriteHandler) { |
|
|
|
((CellWriteHandler)writeHandler).afterCellCreate(writeSheetHolder, writeTableHolder, null, cell, head, |
|
|
|
((CellWriteHandler) writeHandler).afterCellCreate(writeSheetHolder, writeTableHolder, null, cell, head, |
|
|
|
relativeRowIndex, true); |
|
|
|
relativeRowIndex, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -354,21 +354,21 @@ public class WriteContextImpl implements WriteContext { |
|
|
|
try { |
|
|
|
try { |
|
|
|
Workbook workbook = writeWorkbookHolder.getWorkbook(); |
|
|
|
Workbook workbook = writeWorkbookHolder.getWorkbook(); |
|
|
|
if (workbook instanceof SXSSFWorkbook) { |
|
|
|
if (workbook instanceof SXSSFWorkbook) { |
|
|
|
((SXSSFWorkbook)workbook).dispose(); |
|
|
|
((SXSSFWorkbook) workbook).dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Throwable t) { |
|
|
|
} catch (Throwable t) { |
|
|
|
throwCanNotCloseIo(t); |
|
|
|
throwCanNotCloseIo(t); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (writeWorkbookHolder.getAutoCloseStream() && writeWorkbookHolder.getOutputStream() != null) { |
|
|
|
if (writeWorkbookHolder.getTempTemplateInputStream() != null) { |
|
|
|
writeWorkbookHolder.getOutputStream().close(); |
|
|
|
writeWorkbookHolder.getTempTemplateInputStream().close(); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Throwable t) { |
|
|
|
} catch (Throwable t) { |
|
|
|
throwCanNotCloseIo(t); |
|
|
|
throwCanNotCloseIo(t); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (writeWorkbookHolder.getAutoCloseStream() && writeWorkbookHolder.getTemplateInputStream() != null) { |
|
|
|
if (writeWorkbookHolder.getAutoCloseStream() && writeWorkbookHolder.getOutputStream() != null) { |
|
|
|
writeWorkbookHolder.getTemplateInputStream().close(); |
|
|
|
writeWorkbookHolder.getOutputStream().close(); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Throwable t) { |
|
|
|
} catch (Throwable t) { |
|
|
|
throwCanNotCloseIo(t); |
|
|
|
throwCanNotCloseIo(t); |
|
|
|