excel导入如果是数字类型的poi的cell.getStringCellValue()会报错

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yuanlijiefengjuan/article/details/80481095

excel导入如果是数字类型的poi的cell.getStringCellValue()会报错,先将cell转化为文本类型再进行读取

Cell numCell = row.getCell(0);
if(numCell != null){
    numCell.setCellType(Cell.CELL_TYPE_STRING);
}
String cellValue = numCell.getStringCellValue();

即可

猜你喜欢

转载自blog.csdn.net/yuanlijiefengjuan/article/details/80481095