Class CellOneLineHeaderExcelTableReader

java.lang.Object
jp.ecuacion.util.poi.excel.table.ExcelTable<org.apache.poi.ss.usermodel.Cell>
jp.ecuacion.util.poi.excel.table.reader.ExcelTableReader<org.apache.poi.ss.usermodel.Cell>
jp.ecuacion.util.poi.excel.table.reader.concrete.CellOneLineHeaderExcelTableReader
All Implemented Interfaces:
IfDataTypeCellExcelTable, IfExcelTable<org.apache.poi.ss.usermodel.Cell>, IfFormatOneLineHeaderExcelTable<org.apache.poi.ss.usermodel.Cell>, IfDataTypeCellExcelTableReader, IfExcelTableReader<org.apache.poi.ss.usermodel.Cell>, IfFormatOneLineHeaderExcelTableReader<org.apache.poi.ss.usermodel.Cell>

public class CellOneLineHeaderExcelTableReader extends ExcelTableReader<org.apache.poi.ss.usermodel.Cell> implements IfFormatOneLineHeaderExcelTableReader<org.apache.poi.ss.usermodel.Cell>, IfDataTypeCellExcelTableReader
Reads tables with known number of columns, known header labels and known start position of the table.

It obtains cell values as Cell object.

The header line is required. This class reads the table at the designated position and designated lines and columns.
Finish reading if all the columns are empty in a line.

  • Constructor Details

    • CellOneLineHeaderExcelTableReader

      public CellOneLineHeaderExcelTableReader(@RequireNonnull String sheetName, @RequireNonnull String[] headerLabels, @Nullable Integer tableStartRowNumber, int tableStartColumnNumber, @Nullable Integer tableRowSize)
      Constructs a new instance. the obtained value from an empty cell is null.

      tableColumnSize is not designated because tableColumnSize of the table is obviously equal to the length of the header array.

      About the params sheetName, tableStartRowNumber, tableStartColumnNumber, tableRowSize and tableColumnSize, see ExcelTableReader(String, Integer, int, Integer, Integer).

  • Method Details

    • getFarLeftAndTopHeaderLabel

      @Nonnull public String getFarLeftAndTopHeaderLabel()
      Description copied from interface: IfExcelTable
      Returns the value of the far left and top header cell to specify the position of the table.

      The method is called when tableStartRowNumber is null.
      See ExcelTable.tableStartRowNumber

      When the table doesn't have a header and tableStartRowNumber is null, an exception is thrown.
      So always set non-null tableStartRowNumber value when the table doesn't have a header.

      Specified by:
      getFarLeftAndTopHeaderLabel in interface IfExcelTable<org.apache.poi.ss.usermodel.Cell>
      Specified by:
      getFarLeftAndTopHeaderLabel in interface IfFormatOneLineHeaderExcelTable<org.apache.poi.ss.usermodel.Cell>
      Returns:
      far left and top header label
      "top" means the upper side of the header line when the table has multiple header lines.
    • getHeaderLabels

      @Nonnull public String[] getHeaderLabels()
      Description copied from interface: IfFormatOneLineHeaderExcelTable
      Defines the header labels in the excel table.

      It can be like new String[] {"first name", "last name", "age"}.

      Specified by:
      getHeaderLabels in interface IfFormatOneLineHeaderExcelTable<org.apache.poi.ss.usermodel.Cell>