Class AbstractExcelBuilder
java.lang.Object
ch.tocco.nice2.reporting.impl.excel.AbstractExcelBuilder
- All Implemented Interfaces:
ExcelBuilder
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAbstractExcelBuilder
(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.FileBackedOutputStream
creates 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.Workbook
createWorkbook
(String filename) protected abstract OutputCenterInputSupplier.MimeType
withFooter
(List<Object> footer) withHeader
(List<Object> header)
-
Field Details
-
outputCenterService
-
-
Constructor Details
-
AbstractExcelBuilder
-
-
Method Details
-
createWorkbook
-
getOutputCenterMimeType
-
addSheet
Description copied from interface:ExcelBuilder
creates a new sheet in the excel Document. The sheets are ordered in the way they are added by using this method- Specified by:
addSheet
in interfaceExcelBuilder
- Returns:
- the builder itself
-
withTitle
- Specified by:
withTitle
in interfaceExcelBuilder
- Parameters:
title
- the title of the excel sheet- Returns:
- the builder itself
-
withHeader
- Specified by:
withHeader
in interfaceExcelBuilder
- Parameters:
header
- the meta data of the excel sheet- Returns:
- the builder itself
-
withData
- Specified by:
withData
in 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:
addStyle
in 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:ExcelBuilder
creates a excel file using the given data fromExcelBuilder.withHeader(List)
,ExcelBuilder.withData(List)
andExcelBuilder.withFooter(List)
- Specified by:
build
in interfaceExcelBuilder
- Returns:
- the output job id of the created excel file
- Throws:
IOException
-
build
Description copied from interface:ExcelBuilder
creates a excel file using the given data fromExcelBuilder.withHeader(List)
,ExcelBuilder.withData(List)
andExcelBuilder.withFooter(List)
- Specified by:
build
in interfaceExcelBuilder
- Parameters:
model
- theEntityModel
which will be passed to theOutputJobBuilder
- Returns:
- the output job id of the created excel file
- Throws:
IOException
-
buildOutputStream
Description copied from interface:ExcelBuilder
creates an excel and writes it to an output stream using the given data fromExcelBuilder.withHeader(List)
,ExcelBuilder.withData(List)
andExcelBuilder.withFooter(List)
- Specified by:
buildOutputStream
in interfaceExcelBuilder
- Returns:
- outputStream output stream that contains the generated excel
- Throws:
IOException
-