美文网首页
Excel导入Java遇到 Cannot get a numer

Excel导入Java遇到 Cannot get a numer

作者: minzy_gp | 来源:发表于2017-04-10 13:53 被阅读0次

解决方法

Cell cellValue = row.getCell(0);

objFormulaEvaluator.evaluate(cellValue);

String cellValueStr = objDefaultFormat.formatCellValue(cellValue,objFormulaEvaluator);

虽然有很多人也说用直接cell.setCellType(Cell.CELL_TYPE_STRING);但是POIdoc里面写并不推荐这种用法,而且实际我用的时候,编译也未通过。

javadocs声明the only way to convert to a String with formatting remaining is to use the DataFormatter class.

相关文章

网友评论

      本文标题:Excel导入Java遇到 Cannot get a numer

      本文链接:https://www.haomeiwen.com/subject/nbbvnttx.html