Bug 58102 - read excel double value have problem
Summary: read excel double value have problem
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.12-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-05 14:35 UTC by yangcy
Modified: 2015-07-05 15:01 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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