Hi Des I do not think that you can change the type of a cell once it has been initialized - that is once it's type has been set and it holds some data - but I could well be wrong.
Can you simply assume that if you see a numeric cell it contains an integral value? If so, you could probably simply copy the value into an int and rely on it's truncating the value. --- On Wed, 12/17/08, Des Hartman <[email protected]> wrote: From: Des Hartman <[email protected]> Subject: Reading CELL_TYPE_NUMERIC as text To: "POI Users List" <[email protected]> Date: Wednesday, December 17, 2008, 3:44 AM Hi, I have an interesting issue that I could do with some help on. I had a look through the mailing list, but there does not quite seem to be an answer. I am reading a spreadsheet in and converting it to CSV for further processing. The columns are a mixture of String and numeric. As an example: sometext 57 0.1234 someother 2 0.1 When reading it in, column one triggers case HSSFCell.CELL_TYPE_STRING and I process it no problem. However the next two values causes me some grief because of formatting on the excel sheet which I have no control over. the first row the value 57 is formatted as a number and I read it in using HSSFCell.CELL_TYPE_NUMERIC. The resulting text value is 57.0. The next row the number is formatted as text, i.e., '2 and the result is 2 (Which is the desired result) Is there a way to somehow change the cell style to be text before reading, maybe even change the entire sheet to text? It will be read-only processing. -- Thanks Des Hartman
