I am trying to read an excel file using Java POI HSSF. Everything was working fine, except that when the value is 001001 the HSSFCell will return 1001.0
Is there any way I can use HSSFCell to get the value 001001 ?
I am not supposed to do any modification to the excel file.
Thank in advance for any help and suggestion.
Edit
I have been using the following code:
cell.setCellType(Cell.CELL_TYPE_STRING); cell.toString();
I also ran a debug mode and checked on the cell value the moment the HSSF grabs it. It truncate the leading zeros and converted it to double therefore I do not see a way to retrieve the truncated zeros. There is a link that stated it could be a bug from HSSF: http://osdir.com/ml/jakarta.poi.user/2003-02/msg00007.html
By the way, I solved it by hard coded it. The number of digits are know in advanced. The link for the code that I used: How to format a Java string with leading zero?