Have never tried this. But my guess is that the data is stored as a number in the cell in excel and some formatter is applied in Excel. Maybe if you can check the format of the cell and apply your own similar formatting in Java.
Hope this helps. Dónal Donal Doyle Idiro Technologies Synergy Centre, ITT Dublin, Tallaght, Dublin 24, Ireland T +353.1.657.2956 M+353.86.876.1952 F +353.1.443.0582 E: [EMAIL PROTECTED] -----Original Message----- From: Ilya Kasnacheev [mailto:[EMAIL PROTECTED] Sent: 13 July 2007 13:50 To: [email protected] Subject: HSSF: Retrieving numeric cell contents in their actual format I'm using POI HSSF, and I need to dump Excel file into XML. I've wrote most of it, but still have one problem unresolved: I'm looking for a way to get numeric cells' content as a string, formatted exactly as they would be displayed by Excel itself. I mean, date 38629 in "DD.MM.YYYY" should yield "04.10.2005", and 2.25 in "# ?/?" should yield "2 1/4". I haven't found a way to do that, and googling redirects me into HSSFDataFormat which is unrelated, I fail to form a relevant query. Is there a way do get that string representation? Is it already stored in Excel files with possibility to retrieve? Or maybe there's a formatter somewhere which I've overlooked? A converter from HSSF format to Java's NumberFormat and DateFormat (even if not universal)? Maybe any third-party solutions? I guess this problem should be pretty popular. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.10.4/898 - Release Date: 12/07/2007 16:08 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
