I am triing to read exact string values from an excel sheet using the POI library. The problem is that, it is not acceptable to require the user to set the cell type explicitly to text, so excel automatically converts numeric input into a numeric value.
When I'm triing to get the value back as a string, the following problem occurs:
I'm triing to use the
Cell.getStringValue()
function. It throws an exception, since my field is implicitly set to a numeric type field.I'm checking for the field type, and if I notice this happens to be a numeric field, I'm converting it into a string with either
Double.toString
, orCell.toString()
, my field is converted by using decimals, even if it was a round value. For example I write the number '1' into the field. It automatically converts to the 1 numberic value. When I try to get back the string value, I get back the "1.0" string value, wich is problematic.
Is there a way to get back the original string in this scenario? The only solution I can come up after triing this is to forbid using decimals in the user input.