Class ExcelSheetData

java.lang.Object
ch.tocco.nice2.reporting.api.excel.ExcelSheetData

public class ExcelSheetData extends Object
representation of the a excel sheet. Use this class together with ExcelBuilder to create excel files.
  • Method Details

    • create

      public static ExcelSheetData create(String sheetName)
      Creates a ExcelSheetData instance.
      Parameters:
      sheetName - the name of the sheet
    • withTitle

      public ExcelSheetData withTitle(List<Object> title)
      Add a title row to the sheet. The title will always be the first row.
      Parameters:
      title - the title of the excel sheet.
    • withHeader

      public ExcelSheetData withHeader(List<Object> header)
      add a header row to the sheet. If no title is provided using withTitle(List) this will be the first row.
      Parameters:
      header - the header of the excel sheet
    • withFooter

      public ExcelSheetData withFooter(List<Object> footer)
      Add a footer row to the sheet. This will alway be the last row.
      Parameters:
      footer - the footer row of the sheet
    • setMetadata

      public void setMetadata(Metadata metadata)
    • addLine

      public ExcelSheetData addLine(List<Object> line)
      add a single line to the sheet.
      Parameters:
      line - row to add
    • addLines

      public ExcelSheetData addLines(List<List<Object>> lines)
      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

      public String getSheetName()
    • getTitle

      public Optional<List<Object>> getTitle()
    • getHeader

      public Optional<List<Object>> getHeader()
    • getFooter

      public Optional<List<Object>> getFooter()
    • getStyleFunctions

      public List<Function<SheetLocation,Optional<org.apache.poi.ss.usermodel.CellStyle>>> getStyleFunctions()
    • getMetadata

      public Metadata getMetadata()
    • getData

      public List<List<Object>> getData()