https://bz.apache.org/bugzilla/show_bug.cgi?id=65897

            Bug ID: 65897
           Summary: Reading large number in Excel, precision lost
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: vos...@outlook.com
  Target Milestone: ---

When I tried to read very large number in excel,i found the number lost
precision.For example,the number in my excel is '100283710028672000000',i used
poi open the excel file and read the number,but it became
'100283710028672010000'.But no problem with '100283710028673000000' or
'100283710028674000000' or some other numbers.I don't know why.Can you help me?

My code as below:
============================
public static void main(String[] args) throws IOException {
        NumberFormat numberFormat = NumberFormat.getInstance( );
        numberFormat.setGroupingUsed(false);
        String filePath = "D:\\work\\test\\test.xlsx";
        InputStream is = new FileInputStream(filePath);
        XSSFWorkbook wb = new XSSFWorkbook(is);
        XSSFSheet sheet = wb.getSheetAt(0);
        Row row = sheet.getRow(0);
        Cell cell = row.getCell(0);
        String val = numberFormat.format(cell.getNumericCellValue());
        BigDecimal b = new BigDecimal(val);

        System.out.println(b);

    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to