Class ExcelReadUtil

java.lang.Object
jp.ecuacion.util.poi.excel.util.ExcelReadUtil

public class ExcelReadUtil extends Object
Provides excel reading related apache POI utility methods.
  • Method Details

    • getNoDataStringIfNoData

      @Nullable public static String getNoDataStringIfNoData(@Nullable String value, String noDataString)
      Returns proper NoDataString value if the argument value is null or "", otherwize returns the argument value.
      Parameters:
      value - value, may be null.
      Returns:
      the argument value or the empty string designated by noDataString when the argument value is empty.
    • getStringFromCell

      @Nullable public static String getStringFromCell(@Nullable org.apache.poi.ss.usermodel.Cell cell) throws jp.ecuacion.util.poi.excel.exception.ExcelAppException
      Returns String format 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.
      Throws:
      jp.ecuacion.util.poi.excel.exception.ExcelAppException - ExcelAppException
    • getStringFromCell

      @Nullable public static String getStringFromCell(@Nullable org.apache.poi.ss.usermodel.Cell cell, @Nullable String filename) throws jp.ecuacion.util.poi.excel.exception.ExcelAppException
      Returns String format cell value in spite of the format or value kind of the cell.
      Parameters:
      cell - the cell of the excel file
      filename - Used for error message, may be null in which case the error message shows no filename.
      Returns:
      the string which expresses the value of the cell.
      Throws:
      jp.ecuacion.util.poi.excel.exception.ExcelAppException - ExcelAppException
    • getStringFromCell

      @Nullable public static String getStringFromCell(@Nullable org.apache.poi.ss.usermodel.Cell cell, @Nullable String filename, DateTimeFormatter dateTimeFormat) throws jp.ecuacion.util.poi.excel.exception.ExcelAppException
      Returns String format cell value in spite of the format or value kind of the cell.

      return value when row is null or cell is null, etc... is null.

      Parameters:
      cell - the cell of the excel file
      filename - Used for error message, may be null in which case the error message shows no filename.
      dateTimeFormat - dateTimeFormat, may be null in which case defaultDateTimeFormat is used.
      Returns:
      the string which expresses the value of the cell.
      Throws:
      jp.ecuacion.util.poi.excel.exception.ExcelAppException - ExcelAppException
    • getStringFromCell

      @Nullable public static String getStringFromCell(@Nullable org.apache.poi.ss.usermodel.Cell cell, @Nullable String filename, DateTimeFormatter dateTimeFormat, String noDataString) throws jp.ecuacion.util.poi.excel.exception.ExcelAppException
      Returns String format cell value in spite of the format or value kind of the cell.
      Parameters:
      cell - the cell of the excel file
      filename - Used for error message, may be null in which case the error message shows no filename.
      dateTimeFormat - dateTimeFormat, may be null in which case defaultDateTimeFormat is used.
      noDataString - return value when row is null or cell is null, etc...
      Returns:
      the string which expresses the value of the cell.
      Throws:
      jp.ecuacion.util.poi.excel.exception.ExcelAppException - ExcelAppException
    • openForRead

      public static org.apache.poi.ss.usermodel.Workbook openForRead(String filePath) throws org.apache.poi.EncryptedDocumentException, IOException
      Opens the excel file and returns Workbook object.
      Parameters:
      filePath - filePath
      Returns:
      workbook
      Throws:
      org.apache.poi.EncryptedDocumentException - EncryptedDocumentException
      IOException - IOException