Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
海
我想使用 POI API 将单元格文本值转换为 Excel 中的数字。
单元格文本值(如“2,345”)转换为数字。
我怎样才能做到这一点。
如果有人遇到这个问题,请告诉我...
如果您将值存储为字符串,请使用:
String valueAsString = "2345"; cell.setCellValue(new BigDecimal(valueAsString).doubleValue());
如果你的值是一个数字,直接将它传递给方法:
cell.setCellValue(2345);