Alternative to deprecated getCellType

后端 未结 8 2306
自闭症患者
自闭症患者 2020-11-27 05:44

I\'m reading an excel-file (file extension xlsx) using org.apache.poi 3.15.

This is my code:

try (FileInputStream fileInputStream = new FileInputStr         


        
8条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 05:53

    You can use:

    cell.getCellTypeEnum()
    

    Further to compare the cell type, you have to use CellType as follows:-

    if(cell.getCellTypeEnum() == CellType.STRING){
          .
          .
          .
    }
    

    You can Refer to the documentation. Its pretty helpful:-

    https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Cell.html

提交回复
热议问题