Unless someone has any other ideas, you will need to parse the file into an 
HSSFWorkbook and then use wb.getSheet(String) using the sheet's name or 
wb.getSheetAt(int) using the sheet's index (0-based) to get the appropriate 
sheet from the workbook.  That is the only way I have done this in the past.
---- Wakebrad <[EMAIL PROTECTED]> wrote: 
> 
> Using HSSFListener I have successfully parsed the first worksheet in a
> workbook and all worksheets in the workbook but now my users want to be able
> to select which worksheet in the workbook they want to import. Is there a
> way to get the names of the worksheets and declare which worksheet to parse
> using the event model. I can't find a way to get an inputstream from an
> HSSFSheet or a way to retrieve a sheet from the POIFSFileSystem.
> 
> Thanks.
> 
>                       POIFSFileSystem poifs = new 
> POIFSFileSystem(excelFileStream);
>                       // get the Workbook (excel part) stream in a InputStream
>                       InputStream din = 
> poifs.createDocumentInputStream("Workbook");
>                       // construct out HSSFRequest object
>                       HSSFRequest req = new HSSFRequest();
>                       // lazy listen for ALL records with the listener shown 
> above
>                       req.addListenerForAllRecords(this);
>                       // create our event factory
>                       HSSFEventFactory factory = new HSSFEventFactory();
>                       // process our events based on the document input stream
>                       factory.processEvents(req, din);
>                       din.close();
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Selecting-a-specific-worksheet-to-parse-in-event-model-HSSF--tf4395114.html#a12532881
> Sent from the POI - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to