We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get original value from excel

In this case, I want to get the original value from excel like 0.101, but i get the value is 0.10100000000000002.

    Workbook wb = new Workbook(dataDir + "tes.xlsm");
    Worksheet worksheet = wb.getWorksheets().get(0);
    Object h1 = worksheet.getCells().get("G3").getStringValueWithoutFormat();

tes.xlsm.zip (13.9 KB)

How can i get the original value?


Thanks for the template file and sample code.

Please change the line of code,i.e.,

Object h1 = worksheet.getCells().get("G3").getStringValueWithoutFormat();

Object h1 = worksheet.getCells().get("G3").getStringValue();

it will work fine.

Thanks for your reply,
But my problem is so complicated. In my excel, i want to get all original value. Unfortunately, there are some cells , like G1, M1, G3. they are so boring.

So i want to know how to get original value?

    Workbook wb = new Workbook(dataDir + "tes.xlsm");
    Worksheet worksheet = wb.getWorksheets().get(0);
    Object g2 = worksheet.getCells().get("G2").getValue().toString();
    Object m1 = worksheet.getCells().get("M1").getValue().toString();
    Object g3 = worksheet.getCells().get("G3").getValue();

tes.xlsm.zip (14.5 KB)

I also want to know why the value of h1 is 0.10100000000000002


We evaluated your issue further. I extracted the .xlsm file via some zip tool (e.g WinRar tool) and checked the source data in its source xml file for the sheet. I found those long (original) values were actually stored against those cell in the file’s source xml. See the screenshot (attached) for your reference.

In short, Aspose.Cells is actually reading the data/values (unformatted) from file’s source xml data, so it is not an issue with Aspose.Cells.
sc_shot1.png (57.8 KB)