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