On Mon, 31 Aug 2015, Mohamed Ennahdi El Idrissi wrote:
I have been using Apache POI, and I faced a situation where I could use reflection to determine which datatype a cell should have based on the datatype of the value that is going to contain in Excel.

For reading, the normal way to do that is to fetch the cell's type, and read the value based on that. Or, use DataFormatter to give you back a string representation

For writing, POI accepts both objects and primatives. If you're writing something like a number, writing just the number isn't normally enough, you normally also need to apply cell formatting rules to format the cell's contents.

When I tried to use, for instance, anObject.getClass().cast(), the POI library would show an error at compile time, while this code is certainly valid at runtime.

What are you trying to cast to what?

Nick

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

Reply via email to