poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve" <step...@Basit.COM>
Subject Re: Dynamically create worksheets
Date Thu, 06 Mar 2003 23:29:46 GMT
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)" <jd4147@sbc.com>
To: <poi-user@jakarta.apache.org>
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: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>


Mime
View raw message