I put a string into an HSSFCell like this:

cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue("12345");

I open the spreadsheet in Excel and the 12345 looks like a string -- left justified, like I wanted...

...BUT when I double-click the cell to edit it, it has no leading apostrophe. Therefore if I hit Return, or click out of the cell, it becomes a number, even though I didn't really change anything.

It seems like there might be a bug in how HSSF stores the cell value. Is there a workaround for this (or am I missing the correct way to do it)? I really need the string to stay a string. I cannot have a credit card number like "3141592653589793" suddenly becoming "3.14159E+16". (Yes, that is pi; yes, I am a geek. ;))

I have tried 1.5.1-final and 1.8.0-dev versions of HSSF. I found some related postings in the archives, but none that answered this exact question.

--Andy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to