Incorrect data while reading excel sheet in Java

To read the contents of the cell without any formatting I am using below method

cell.getStringValueWithoutFormat();

When I try to read attached Excel I get extra digits after decimal even though those are not present in Excel which leads to incorrect data. For this instance, there are multiple cells in F column (F24, F25, F35, etc.). I have to use cell.getStringValueWithoutFormat() only as I don’t want any formatting.

Actual data in Excel - 2057.166
cell.getStringValueWithoutFormat() - 2057.1659999999997

Is there any reason of API giving incorrect data?

Also attached Excel for referenceOrders-With Nulls.zip (92.3 KB)

Thanks,
Nemish

@nemish.doshi,

I checked your file and used my sample code and got results, e.g. for F24 cell in first sheet, I got “2057.1659999999997” which is expected and right result. Please note, in your template file (source .xml of the file), the saved value of this cell is “2057.1659999999997” value. I used some zip tool to open your file into it and check/confirm the value, see the screenshot (attached) for your reference. Same is the case for your other mentioned cells. So, there is no issue on Aspose.Cells’ end by any means. This is MS Excel’s behavior where the value is shown as “2057.166” when opening the file into it. I am afraid, Aspose.Cells just processes source file format and use/get the value from its original source (xml) data. So, you have to use your own (Java) code to just part value or split value accordingly to your specific needs.
sc_shot1.png (72.8 KB)

Thanks @Amjad_Sahi for prompt response

@nemish.doshi,

You are welcome.