Thanks Amol. I am using the getCellType() and a bunch of if-then-else's to extract the String representation of a cells value in a utility method but my point was that this was too much work just to extract the String representation of the data. And that such a method should be part of the API.
If you feel that HSSFCell.getStringCellValue() should return only if the data type is String else throw exception, them maybe it would be nice if the toString() method was overridden in this class. Consider reading a spreadsheet and writing out an XML file representation where I just want to read the String values. Thanks, Sanjiv On 8/26/05, Amol Deshmukh <[EMAIL PROTECTED]> wrote: > > Sanjiv, > you could switch on getCellType() and contruct the string representation > yourself. > You may also want to consider using HSSFDataFormat class to format the > string > as seen in excel. > > ~ amol > > > -----Original Message----- > > From: Sanjiv Jivan [mailto:[EMAIL PROTECTED] > > Sent: Friday, August 26, 2005 2:25 PM > > To: POI Users List > > Subject: HSSFCell.getStringCellValue too strict > > > > > > Hi, > > HSSFCell.getStringCellValue() thows various > > NumberFormatException's if the > > data type in Excel is not of String type. I think this is too strict. > > Throwing an exception when getting a number from String field > > makes sense > > but I would much prefer if HSSFCell.getStringCellValue returned to > > toString() value of whatever the cell value. > > > > Thanks, > > Sanjiv > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > >
