Class AbstractExcelBuilder
java.lang.Object
ch.tocco.nice2.reporting.impl.excel.AbstractExcelBuilder
- All Implemented Interfaces:
ExcelBuilder
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractExcelBuilder(String filename, OutputCenterService outputCenterService) -
Method Summary
Modifier and TypeMethodDescriptionaddSheet(ExcelSheetData data) creates a new sheet in the excel Document.addStyle(Function<SheetLocation, Optional<org.apache.poi.ss.usermodel.CellStyle>> function) build()creates a excel file using the given data fromExcelBuilder.withHeader(List),ExcelBuilder.withData(List)andExcelBuilder.withFooter(List)build(@Nullable EntityModel model) creates a excel file using the given data fromExcelBuilder.withHeader(List),ExcelBuilder.withData(List)andExcelBuilder.withFooter(List)com.google.common.io.FileBackedOutputStreamcreates an excel and writes it to an output stream using the given data fromExcelBuilder.withHeader(List),ExcelBuilder.withData(List)andExcelBuilder.withFooter(List)protected abstract org.apache.poi.ss.usermodel.WorkbookcreateWorkbook(String filename) protected abstract OutputCenterInputSupplier.MimeTypewithFooter(List<Object> footer) withHeader(List<Object> header)
-
Field Details
-
outputCenterService
-
-
Constructor Details
-
AbstractExcelBuilder
-
-
Method Details
-
createWorkbook
-
getOutputCenterMimeType
-
addSheet
Description copied from interface:ExcelBuildercreates a new sheet in the excel Document. The sheets are ordered in the way they are added by using this method- Specified by:
addSheetin interfaceExcelBuilder- Returns:
- the builder itself
-
withTitle
- Specified by:
withTitlein interfaceExcelBuilder- Parameters:
title- the title of the excel sheet- Returns:
- the builder itself
-
withHeader
- Specified by:
withHeaderin interfaceExcelBuilder- Parameters:
header- the meta data of the excel sheet- Returns:
- the builder itself
-
withData
- Specified by:
withDatain interfaceExcelBuilder- Parameters:
data- the effective data of the sheet- Returns:
- the builder itself
-
addStyle
public ExcelBuilder addStyle(Function<SheetLocation, Optional<org.apache.poi.ss.usermodel.CellStyle>> function) - Specified by:
addStylein interfaceExcelBuilder- Parameters:
function- a function which is applied to any cell in the excel. If it returns a cellStyle it will be applied to the cell- Returns:
- the builder itself
-
build
Description copied from interface:ExcelBuildercreates a excel file using the given data fromExcelBuilder.withHeader(List),ExcelBuilder.withData(List)andExcelBuilder.withFooter(List)- Specified by:
buildin interfaceExcelBuilder- Returns:
- the output job id of the created excel file
- Throws:
IOException
-
build
Description copied from interface:ExcelBuildercreates a excel file using the given data fromExcelBuilder.withHeader(List),ExcelBuilder.withData(List)andExcelBuilder.withFooter(List)- Specified by:
buildin interfaceExcelBuilder- Parameters:
model- theEntityModelwhich will be passed to theOutputJobBuilder- Returns:
- the output job id of the created excel file
- Throws:
IOException
-
buildOutputStream
Description copied from interface:ExcelBuildercreates an excel and writes it to an output stream using the given data fromExcelBuilder.withHeader(List),ExcelBuilder.withData(List)andExcelBuilder.withFooter(List)- Specified by:
buildOutputStreamin interfaceExcelBuilder- Returns:
- outputStream output stream that contains the generated excel
- Throws:
IOException
-