为了账号安全,请及时绑定邮箱和手机立即绑定

使用 poi 读取 excel 公式的问题

使用 poi 读取 excel 公式的问题

有只小跳蛙 2022-01-12 16:04:49
在使用公式格式解析列中值的 excel 文件时,我收到 null。这是我的代码:  Cell cell = row.getCell(i);          CellValue cellValue = evaluator.evaluate(cell);          switch(cell.getCellType())          {            case Cell.CELL_TYPE_NUMERIC:                returnedMap.put(arrayForMappingNames[index], ""+cell.getNumericCellValue());                break;            case Cell.CELL_TYPE_STRING:                returnedMap.put(arrayForMappingNames[index], cell.getStringCellValue());                break;            case Cell.CELL_TYPE_FORMULA :                 returnedMap.put(arrayForMappingNames[index], cellValue.getStringValue());                break;            default :                 returnedMap.put(arrayForMappingNames[index], ExcellUtil.DEFAULT_VALUE);          }
查看完整描述

1 回答

?
芜湖不芜

TA贡献1796条经验 获得超7个赞

Cell cell = row.getCell(i);

          CellValue cellValue = evaluator.evaluate(cell);

          String columnValue = formatter.formatCellValue(cell, evaluator);

          returnedMap.put(arrayForMappingNames[index], columnValue);


查看完整回答
反对 回复 2022-01-12
  • 1 回答
  • 0 关注
  • 293 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号