Class ExcelTableReader<T>
- Type Parameters:
T- SeeIfExcelTable.
- All Implemented Interfaces:
IfExcelTable<T>,IfExcelTableReader<T>
- Direct Known Subclasses:
CellFreeExcelTableReader,CellOneLineHeaderExcelTableReader,StringExcelTableReader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected @Min(1L) IntegerIs the column size of the table.protected @Min(1L) IntegerIs the row size of the table.Fields inherited from class jp.ecuacion.util.poi.excel.table.ExcelTable
sheetName, tableStartColumnNumber, tableStartRowNumber -
Constructor Summary
ConstructorsConstructorDescriptionExcelTableReader(String sheetName, Integer tableStartRowNumber, int tableStartColumnNumber, Integer tableRowSize, Integer tableColumnSize) Constructs a new instance with the sheet name, the position and the size of the excel table. -
Method Summary
Modifier and TypeMethodDescriptionReturns an instance ofExcelReadUtil.protected IntegergetTableColumnSize(org.apache.poi.ss.usermodel.Sheet sheet, int poiBasisDeterminedTableStartRowNumber, int poiBasisDeterminedTableStartColumnNumber) Returns tableColumnSize, may benull.protected IntegerReturns tableRowSize, may benull.Reads a table data in an excel file atexcelPathand Return it in the form ofList<List<String>>.voidsetTableColumnSize(int tableColumnSize) setstableColumnSize.Methods inherited from class jp.ecuacion.util.poi.excel.table.ExcelTable
getPoiBasisDeterminedTableStartColumnNumber, getPoiBasisDeterminedTableStartRowNumber, getSheetNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jp.ecuacion.util.poi.excel.table.IfExcelTable
getFarLeftAndTopHeaderLabel, getHeaderLabelData, getSheetName, getStringValue, validateHeaderDataMethods inherited from interface jp.ecuacion.util.poi.excel.table.reader.IfExcelTableReader
getCellData, isCellDataEmpty, updateAndGetHeaderData
-
Field Details
-
tableRowSize
Is the row size of the table.It's equal to or greater than
1.
0or the number smaller than that is not acceptable.
nullis acceptable, which meanstableRowSizeis decided for the program to find an empty row.
When the table has a header, the row size includes the header line, -
tableColumnSize
Is the column size of the table.It's equal to or greater than
1.
0or the number smaller than that is not acceptable.
nullis acceptable, which meanstableColumnSizeis decided by the length of the header. Empty header cell means it's the end of the header.
When the table has a header, the row size includes the header line,
-
-
Constructor Details
-
ExcelTableReader
public ExcelTableReader(@RequireNonnull String sheetName, @Nullable Integer tableStartRowNumber, int tableStartColumnNumber, @Nullable Integer tableRowSize, @Nullable Integer tableColumnSize) Constructs a new instance with the sheet name, the position and the size of the excel table.- Parameters:
sheetName- SeeExcelTable.sheetName.tableStartRowNumber- SeeExcelTable.tableStartRowNumber.tableStartColumnNumber- SeeExcelTable.tableStartColumnNumber.tableRowSize- SeetableRowSize.tableColumnSize- SeetableColumnSize.
-
-
Method Details
-
read
@Nonnull public List<List<T>> read(@RequireNonnull String excelPath) throws org.apache.poi.EncryptedDocumentException, jp.ecuacion.lib.core.exception.checked.AppException, IOException Reads a table data in an excel file atexcelPathand Return it in the form ofList<List<String>>.The internal
List<String>stores data in one line.
The externalListstores lines ofList<String>.- Throws:
IOException- IOExceptionjp.ecuacion.lib.core.exception.checked.AppException- AppExceptionorg.apache.poi.EncryptedDocumentException- EncryptedDocumentException
-
getTableRowSize
Returns tableRowSize, may benull. -
getTableColumnSize
@Nonnull protected Integer getTableColumnSize(@RequireNonnull org.apache.poi.ss.usermodel.Sheet sheet, int poiBasisDeterminedTableStartRowNumber, int poiBasisDeterminedTableStartColumnNumber) throws jp.ecuacion.lib.core.exception.checked.BizLogicAppException Returns tableColumnSize, may benull.- Parameters:
sheet- sheetpoiBasisDeterminedTableStartRowNumber- poiBasisDeterminedTableStartRowNumberpoiBasisDeterminedTableStartColumnNumber- poiBasisDeterminedTableStartRowNumber- Throws:
jp.ecuacion.lib.core.exception.checked.BizLogicAppException- BizLogicAppException
-
setTableColumnSize
public void setTableColumnSize(int tableColumnSize) setstableColumnSize.tableColumnSize can be set by the header length, but the instance method cannot be called from constructors so the setter is needed.
This method set the final value of the column size, so the argument is not
Integer, but primitiveint.- Parameters:
tableColumnSize- tableColumnSize.
-
getExcelReadUtil
Description copied from interface:IfExcelTableReaderReturns an instance ofExcelReadUtil.- Specified by:
getExcelReadUtilin interfaceIfExcelTableReader<T>- Returns:
ExcelReadUtilinstance
-