Shailesh,

Can you modify these functions at all? One solution is to create the sheet _outside_ of the function and pass it as a parameter to it.
The only other way is to pass the workbook to each function and do the creating of the sheet inside of that.
AFAIK the sheets can only be created by the createSheet () method of the workbook. You cannot make a sheet without it being based upon a workbook.


HTH

Chris

Shailesh Ligade wrote:

Thanks Ethan,

I don't have any problem doing this, but I have functions which are
returning just sheet (more than one) and now I need to create workbook
and add those sheets to it. That is where I have problem.

Shailesh

-----Original Message-----
From: Knepp, Ethan [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 10:35 AM
To: 'POI Users List'
Subject: RE: adding a speadsheet


Shailesh,

Below is the order in which I create a new workbook and add a sheet to
it...

// create the output stream for the workbook
FileOutputStream out = new FileOutputStream(ssLocation + ssName);

// create a new workbook
HSSFWorkbook wb = new HSSFWorkbook();

// create a new sheet
HSSFSheet sheet = wb.createSheet();

After you create the sheet you can add rows and cells to it.

Check the following link for a good examples:
http://jakarta.apache.org/poi/hssf/quick-guide.html

Hope this helps.
-Ethan

-----Original Message-----
From: Shailesh Ligade [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 10:31 AM
To: [EMAIL PROTECTED]
Subject: adding a speadsheet


Hello All,


I need to create excel file with many sheet. One of my java class, will
call bunch of classes, each returning a sheet, and then calling calls
will create workbook and able to add all the sheets to it. Is this
possible using POI? I didn't see any API for doing this. Sheet
constructors are protected, and I didn't find any way to add sheet to
workbook passing a sheet.

Thanks
SL


--------------------------------------------------------------------- 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