While reading a cell from Spreadsheet the precision is changed from 10 to 6 digits after decimal in 3.17 version org.apache.poi.ss.usermodel.DataFormatter dataFormatter = new DataFormatter(); String content = dataFormatter .formatCellValue(Cell); Value in the spreadsheet is 1290.219821387213 Earlier version 3.12 value returned is 1290.2198213872 but the precision is reduced to 6 digits after decimal in latest version to 1290.219821
The getformat() method of the DataFormatter of the 3.12 version directly obtains the Format class. The getformat() function in the dataFormatter of the 3.17 version is changed, and a new ExcelGeneralNumberFormat class is returned. The implementation in dataFormatter.formatCellValue() is implemented by the getformat() method in the ExcelGeneralNumberFormat class. The TO_10_SF constant is used to limit the data length. This restriction does not exist in the 3.12 version. It can be considered as a version difference. This is the code segment where you feel the precision is faulty: private static final MathContext TO_10_SF = new MathContext(10, RoundingMode.HALF_UP); final double rounded = new BigDecimal(value).round(TO_10_SF).doubleValue();
The DataFormatter is configurable. Excel stores numbers in floating point format so you need to format the numbers to get a value that matches expectation. We will not revert to the behaviour in 3.12, a release from 5 years ago. Most users are used to the current behaviour.