I format the cell as text and it works.
cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
Simon.-----Original Message----- From: Andy Lee [mailto:[EMAIL PROTECTED]] Sent: Monday, February 03, 2003 3:57 PM To: [EMAIL PROTECTED] Subject: How to get "12345" to be a real string? 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] *********************************************************************** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. *********************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
