I have a requirement to get the cell value after applying the configured formatting when the cell is formatted to display the rounded value.
Example ---------
I have a cell where the value might be a decimal value. On the display I want to display it as a rounded number. But, when I use it, I should be able to use the original value (i.e., the exact decimal number).
I know this is possible in Ms. Excel. But I am not able to find the API where I get the formatted value instead of the absolute value. For value retrieval I am unsing Cell.getValue() API which I know is not the right API.
Please help me in this regard. I am sending the sample code which I am using.
When I run your code with your template files I got the original value "11.05", Is it not your need and do you not get this? Following is my output result:
Main Method START .... Cell Value = null Cell Value = 11.05 Main Method EXIT ....
If you want get the int value only you may use Cell.getIntValue() method, It will give you "11" only.
I think I failed to communicate my expectations correctly in my last post. Let me put my example in a different way.
Suppose the original value is 14.055.
Assuming that I do not know the formatting that has been applied in the cell I would like to get the value as 14 (if the cell is formatted to display integer value) OR 14.05 (if the cell is formatted to display decimal values upto 2 precisions after decimal point) ON THE FLY (at runtime).
The solution suggested by you expects me to know the formatting on a particular cell (then only I can invoke getIntValue() kind of APIs). But I don't want to be concerned about the formatting; I just need to get the displayable value after formatting has been applied.
Please let me know if you need furthor clarification.