Class ExcelSheetData
java.lang.Object
ch.tocco.nice2.reporting.api.excel.ExcelSheetData
representation of the a excel sheet.
Use this class together with
ExcelBuilder
to create excel files.-
Method Summary
Modifier and TypeMethodDescriptionadd a single line to the sheet.add multiple rows to the sheet.addStyle
(Function<SheetLocation, Optional<org.apache.poi.ss.usermodel.CellStyle>> function) static ExcelSheetData
Creates aExcelSheetData
instance.getData()
List
<Function<SheetLocation, Optional<org.apache.poi.ss.usermodel.CellStyle>>> getTitle()
void
setMetadata
(Metadata metadata) withFooter
(List<Object> footer) Add a footer row to the sheet.withHeader
(List<Object> header) add a header row to the sheet.Add a title row to the sheet.
-
Method Details
-
create
Creates aExcelSheetData
instance.- Parameters:
sheetName
- the name of the sheet
-
withTitle
Add a title row to the sheet. The title will always be the first row.- Parameters:
title
- the title of the excel sheet.
-
withHeader
add a header row to the sheet. If no title is provided usingwithTitle(List)
this will be the first row.- Parameters:
header
- the header of the excel sheet
-
setMetadata
-
addLine
add a single line to the sheet.- Parameters:
line
- row to add
-
addLines
add multiple rows to the sheet. This method won't replace data. It appends the given rows to the existing ones.- Parameters:
lines
- mutiple rows to add
-
addStyle
public ExcelSheetData addStyle(Function<SheetLocation, Optional<org.apache.poi.ss.usermodel.CellStyle>> function) - 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
-
getSheetName
-
getTitle
-
getHeader
-
getStyleFunctions
public List<Function<SheetLocation,Optional<org.apache.poi.ss.usermodel.CellStyle>>> getStyleFunctions() -
getMetadata
-
getData
-