Sorry about the silence, I didn't get a chance to run the tests until now. 1) The unit tests all run, with the exception of 10, and looking at those, they don't seem to have anything to do with record factory. (Removing SeriesTextRecord.class and re-running gives the same 10 failures.) 2) HSSF readwrite test fails with or without the class included. The file is generated, but when opening with Excel, I get a dialog of "data may have been lost" and some of the displays are indeed "#NAME?"s
a cursory glance at the printlns for the stRecord.getText() seems to indicate that it is correct though. So reading seems to be fine. Jeff Wang diCarta, Inc. -----Original Message----- From: Andrew C. Oliver [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 4:28 PM To: [email protected] Subject: Re: HSSF SeriesTextRecord not included in RecordFactory? I do not know of a specific reason it is not there. When you add it do the unit tests pass? Moreover if you do the rewrite test on a sheet with one in it: org.apache.poi.hssf.dev.HSSF input.xls output.xls is the result okay? If not...that is the reason. If so...I can think of no reason. [EMAIL PROTECTED] wrote: >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/
