You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Jim Cobban <jc...@magma.ca> on 2002/12/05 16:30:46 UTC

HSSF eventusermodel need approximate number of rows in sheet

OK.  Following the advice from this group I restructured my program to use
eventusermodel to read the spreadsheet.  This is much more efficient.
However in this model I need to record the contents of the spreadsheet in my
own data structure.  A Vector seems the obvious choice for me, since there
will be few completely empty rows in the spreadsheet, and Vector gives
constant access time.  So now I need an estimate of the number of rows in
the spreadsheet to allocate the capacity of the Vector.  Since all I need is
a good estimate it seems to me that I should be able to depend upon the
fields in the spreadsheet which record the first and last rows.

Now if I am not mistaken those fields are presented in the usereventmodel in
the RowRecordsAggregate record.  At least that record has methods
getFirstRowNum() and getLastRowNum().  However there seems to be a problem
with RowRecordsAggregate.  When I attempt to identify whether the Record I
have received is a RowRecordsAggregate I am informed by the compiler that :

ReadXls.java:157: non-static variable sid cannot be referenced from a static
context
            case RowRecordsAggregate.sid:
                                    ^

This would appear to be an error in the definition of RowRecordsAggregate.

Do I have to retrieve the source and recompile this class?  Or is there an
easier way to obtain the information I am seeking.

Jim Cobban   jcobban@magma.ca
34 Palomino Dr.
Kanata, ON, CANADA
K2M 1M1
+1-613-592-9438