Bug 58102

Summary: read excel double value have problem
Product: POI Reporter: yangcy <465406325>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P2    
Version: 3.12-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description yangcy 2015-07-05 14:35:03 UTC
hello, I`AM use poi 3.12 read excel have two problem:
(1)  excel Numerical value for text storage poi read cell type become Cell.CELL_TYPE_NUMERIC. e.g: excel value : "234234342" poi read value become 234234342.0
(2)  excel double value poi read value have Many decimal places.  e.g: excel value  12.008 poi read become 12.0079999999999

I hope POI cell.getNumericCellValue() does not use Double, but BigDecimal.
I set up the cell to the text type in EXCEL, because the cell.getCellType POI () can get the corresponding Cell.CELL_TYPE_STRING
Comment 1 Nick Burch 2015-07-05 15:01:59 UTC
This is all exactly as expected. Excel uses floating point numbers to store and represent numeric values

To get a string that looks like what Excel displays for a cell, you need to use DataFormatter