Sorry, bad copy and paste, I was trying to remove extraneous code in between the cast and the getText()...
What I originally had was: SeriestTextRecord stRecord = (SeriesTextRecord) record; .... stRecord.getText(); In any case, the passed in record is of type UnknownRecord as opposed to the expected SeriesTextRecord. Switching on record.getSid() gets us to the case statement. I have added in SeriesTextRecord.class in line 46 of org.apache.poi.hssf.record.RecordFactory, and everything works fine - the passed in record is of the expected type. I'm just wondering whether the fact that it's not in RecordFactory is just a oversight(bug?) or was there a deliberate reason for removing it. Thanks for the help. Jeff Wang diCarta, Inc. -----Original Message----- From: Andrew C. Oliver [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 2:30 PM To: POI Users List Subject: Re: HSSF SeriesTextRecord not included in RecordFactory? [EMAIL PROTECTED] wrote: > I am getting a class cast exception on the following in my listener: > > case SeriesTextRecord.sid: > String text = (SeriesTextRecord) record.getText(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ case SeriesTextRecord.sid: String text = ((SeriesTextRecord)record).getText(); > > When I prepend the case statement with the following: > if (record instanceof UnknownRecord) { > UnknownRecord ur = (UnknownRecord) record; > System.out.println("Excel extractor can't handle record > type "+ur.getSid()); > return; > } > > I get a lot of: > Excel extractor can't handle record type 4109 > > Which is the sid for SeriesTextRecord. Looking at > org.apache.poi.hssf.record.RecordFactory, SeriesTextRecord.class is > included in neither of the lists. Should it be? > > Jeff Wang > diCarta, Inc. > > --------------------------------------------------------------------- > 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/ > > -- Andrew C. Oliver SuperLink Software, Inc. Java to Excel using POI http://www.superlinksoftware.com/services/poi Commercial support including features added/implemented, bugs fixed. --------------------------------------------------------------------- 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/ --------------------------------------------------------------------- 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/
