Hello Mark,

Thank you for your extensive answer, it is getting a bit more clear for
me now, although I run into difficulties with not being able to
duplicate the problem.

It definitively has to do with the float to double conversion here.
Using getNumericCellValue() sometimes returns me a value not being
exactly the value entered by the user. For example, I am looking at a
field in which the user entered the value 7,8268
This looks like a number with four decimals, but somehow when using
getNumericCellValue() it shows up as being 7.8267999999999995. Strange
thing is I cannot duplicate this, when typing the number in myself, it
keeps showing up like 7.8268, so correct.
Anyhow, I experimented a bit more with the retrieval of the value, and
found out I can overcome the above issue when casting to a float, like:

            double doubleValue = cell.getNumericCellValue();
            // format the number as floating point:
            value = String.valueOf((float) doubleValue);

In this case I get exactly what the user originally used as input.
BTW, in my code, I indeed do a check on celltype. I tried to copy just
the part of code necessary for the issue I had...
Oh, and getting the value as a string.... I am writing the values to an
XML file, so that's why I took it as a String, no need for further math
here.

Thanks,
Frank

PS I can only dream of an Office-less office :-)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to