You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Fermin Da Costa Gomez <da...@dcgconsultancy.nl> on 2010/01/20 16:38:39 UTC

Re: Retrieve sheet using event model [SOLVED]

Found a solution to my own question ..
Whilst processing all the records the BoundSheetRecord can be used to
determine the sheet required.
In the example code this structure is used in the XLS2CSV example, written
by Nick Burch.

I added a private sheetName and replace the BoundSheetRecord case with the
following code.

...
      case BoundSheetRecord.sid:
          if (this.sheetName==null) { // Process ALL sheets
              boundSheetRecords.add(record);
          } else if
(((BoundSheetRecord)record).getSheetname().equals(this.sheetName)) { // Only
process one specified sheet
              boundSheetRecords.add(record);
          }
        break;
...




On Wed, Jan 20, 2010 at 4:08 PM, Fermin Da Costa Gomez <
dacostagomez@gmail.com> wrote:

> Hi,
>
> Looking at at the 2 xls2csv examples using the event model i noticed that
> all data is processed into 1 csv file, not respecting the sheets/tabs in the
> workbook.
> I'm trying to find the (or any) way to 'select a sheet' and just process
> the rows pertaining to that sheet.
>
> Obviously i'm not being very succesfull .. :-(
>
> If somebody has any suggestion as to where i can find some doc on this or a
> snip it would be much appreciated.
> Will continue looking off course.
>
> Tia,
>
> Fermin DCG
>
>
>
> --
> “The reasonable man adapts himself to the world; the unreasonable one
> persists in trying to adapt the world to himself. Therefore all progress
> depends on the unreasonable man.”
> - George Bernard Shaw (1856 - 1950)
>



-- 
“The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all progress
depends on the unreasonable man.”
- George Bernard Shaw (1856 - 1950)