Thanks Martin. I only thought about regular expressions afyer posting a reply to Rob this morning and do agree that would be the best approach in this case. The other bonus of course is that it can make an application configurable - the expressions can be defined in a properties file making internationalisation far easier.
--- On Thu, 10/16/08, Martin Schöffler <[EMAIL PROTECTED]> wrote: From: Martin Schöffler <[EMAIL PROTECTED]> Subject: Re: Excel complains when I put numeric strings into text cells To: "POI Users List" <[email protected]>, [EMAIL PROTECTED] Date: Thursday, October 16, 2008, 6:07 AM >From looking at the source code of HSSFCellUtil I don't think that will help, as it exactly does what Rob described - treating every value as a string. Probably the best way to go is to use some regular expressions to find out what kind of data (text or numeric) you are getting before creating the cells. Note that dates are also stored as numeric in excel but have a format attached. Same applies for other special numeric formats (with currency symbols or fixed number of decimal places). Cheers, Martin On Thu, Oct 16, 2008 at 11:54 AM, Anthony Andrews <[EMAIL PROTECTED]> wrote: > Hello again Rob. If you read my last message, you will be well aware of the HSSFCellUtil class by now. This class may even handle these issues for you. Would be inclined to give it a go firstly and then look at exception catching or regular expressions later. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
