There are different approaches possible.
It depends on whether you need to have graphics, and need to start with a
template.
It's simpler if you don't need that capability.

When you create a sheet, you can give it a name:
createSheet(java.lang.String sheetname)
When you create it, you have the object reference, so you can do anything
you want with it.
But, if you lose the reference, you can get it via
getSheet(java.lang.String name)
You can also get the 0-based index of any sheet by:
getSheetIndex(java.lang.String name)
and, when you know the index, you can get the name
getSheetName(int sheet)
to get the actual HSSFSheet, you can get it by either index or by name:
 HSSFSheet getSheet(java.lang.String name)
          Get sheet with the given name
 HSSFSheet getSheetAt(int index)
          Get the HSSFSheet object at the given index.
I assume you have the JAVADOC API on your PC, which is indexed at:
\build\docs\javadocs\index.html
after you install the release.


----- Original Message -----
From: "DRINKARD, JAMES E (SBCSI)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 06, 2003 5:19 PM
Subject: Dynamically create worksheets


> Hello All,
> I am trying to come up with a way to dynamically create worksheets, as the
> number of sheets isn't fixed, for a java report generating program I
> developed. I'm using POI version 1.5.0. to create an xls spreadsheet that
I
> populate with an resultset. I've been able to create multiple sheets, but
I
> don't know how to reference them in the code, without hard coding each one
> and therefore cannot populate them. Any ideas as to the best way to do
this?
>
> James
>
> ---------------------------------------------------------------------
> 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