Get original value from excel

Hi,
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();
    System.out.println(h1);

tes.xlsm.zip (13.9 KB)

How can i get the original value?

@qinghualiu,

Thanks for the template file and sample code.

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

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

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

it will work fine.

Hi,
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();
    System.out.println(g2);
    System.out.println(m1);
    System.out.println(g3);

tes.xlsm.zip (14.5 KB)

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

@qinghualiu,

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)