java.lang.Object
jp.ecuacion.util.poi.excel.util.ExcelReadUtil
Provides excel reading related
apache POI utility methods.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance withNoDataString = NULL.ExcelReadUtil(NoDataString noDataString) Constructs a new instance with designatedNoDataString. -
Method Summary
Modifier and TypeMethodDescriptiongetNoDataStringIfNoData(String value) Returns properNoDataStringvalue if the argument value isnullor"", otherwize returns the argument value.getReadyToReadTableData(ExcelTableReader<T> reader, org.apache.poi.ss.usermodel.Workbook workbook, String sheetName, Integer numberOfHeaderLinesIfReadsHeaderOnlyOrNull) Gets ready to read table data.getStringFromCell(org.apache.poi.ss.usermodel.Cell cell) ReturnsStringformat cell value in spite of the format or value kind of the cell.getStringFromCell(org.apache.poi.ss.usermodel.Cell cell, String dateTimeFormat) ReturnsStringformat cell value in spite of the format or value kind of the cell.org.apache.poi.ss.usermodel.WorkbookopenForRead(String filePath) Opens the excel file and returnsWorkbookobject.<T> List<T> readTableLine(ExcelTableReader<T> reader, ExcelTable.ContextContainer context, int rowNumber) Provides common procedure for read one line of a table.voidsetDefaultDateTimeFormat(String dateTimeFormat) Sets defaultDateTimeFormat.
-
Constructor Details
-
ExcelReadUtil
public ExcelReadUtil()Constructs a new instance withNoDataString = NULL.NoDataString = NULLis recommended. SeeNoDataString. -
ExcelReadUtil
Constructs a new instance with designatedNoDataString.NoDataString = NULLis recommended. SeeNoDataString.- Parameters:
noDataString- noDataString
-
-
Method Details
-
setDefaultDateTimeFormat
Sets defaultDateTimeFormat.- Parameters:
dateTimeFormat- dateTimeFormat
-
getNoDataStringIfNoData
Returns properNoDataStringvalue if the argument value isnullor"", otherwize returns the argument value.- Parameters:
value- value, may benull.- Returns:
- the argument value or the empty string designated by
noDataStringwhen the argument value is empty.
-
getStringFromCell
ReturnsStringformat cell value in spite of the format or value kind of the cell.- Parameters:
cell- the cell of the excel file- Returns:
- the string which expresses the value of the cell.
-
getStringFromCell
@Nullable public String getStringFromCell(@Nullable org.apache.poi.ss.usermodel.Cell cell, String dateTimeFormat) ReturnsStringformat cell value in spite of the format or value kind of the cell.- Parameters:
cell- the cell of the excel filedateTimeFormat- dateTimeFormat, may benullin which casedefaultDateTimeFormatis used.- Returns:
- the string which expresses the value of the cell.
-
openForRead
public org.apache.poi.ss.usermodel.Workbook openForRead(String filePath) throws org.apache.poi.EncryptedDocumentException, IOException Opens the excel file and returnsWorkbookobject.- Parameters:
filePath- filePath- Returns:
- workbook
- Throws:
org.apache.poi.EncryptedDocumentException- EncryptedDocumentExceptionIOException- IOException
-
getReadyToReadTableData
public <T> ExcelTable.ContextContainer getReadyToReadTableData(ExcelTableReader<T> reader, org.apache.poi.ss.usermodel.Workbook workbook, String sheetName, Integer numberOfHeaderLinesIfReadsHeaderOnlyOrNull) throws jp.ecuacion.lib.core.exception.checked.BizLogicAppException Gets ready to read table data.- Throws:
jp.ecuacion.lib.core.exception.checked.BizLogicAppException
-
readTableLine
public <T> List<T> readTableLine(ExcelTableReader<T> reader, ExcelTable.ContextContainer context, int rowNumber) Provides common procedure for read one line of a table.
-