Java Apache POI 读取 Excel 数值数据时避免发生科学计数法问题的解决方法


第一种

    DecimalFormat decimalFormat = new DecimalFormat("0");
    cellValue = decimalFormat.format(cell.getNumericCellValue());

第二种

    NumberFormat numberFormat = NumberFormat.getInstance();
    cellValue = numberFormat.format(cell.getNumericCellValue());
    if (cellValue.indexOf(",") >= 0) {
        cellValue = cellValue.replace(",", "");
    }

第三种

在写入Excel 时不想出现科学技术法数值前加上英文半角字符“’”,如下图:


《“Java Apache POI 读取 Excel 数值数据时避免发生科学计数法问题的解决方法”》 有 1 条评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注