使用POI 读取 Excel 文件,读取手机号码 变成 科学计数 的解决办法 https://my.oschina.net/u/2331760/blog/1162895
第一种方法:
主动改变excel表格的数据类型:
1 2 3 4 5 |
Cell cell=row.getCell(0); if(cell.getCellType() != Cell.CELL_TYPE_STRING){ cell.setCellType(Cell.CELL_TYPE_STRING); } String phone=cell.getStringCellValue(); |
第二种:利用format格式化:
1 2 3 |
Cell cell=row.getCell(0); DecimalFormat df = new DecimalFormat("#"); String phone = df.format(cell.getNumericCellValue()); |