You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Brian Glick <B....@Freightek.com> on 2003/01/09 17:11:17 UTC

Wrapping rows to a new sheet

Does anyone have a method to create a new sheet once you've exceeded the 65K
row limit in a sheet?  I'm trying to run a 70,000 line report, and I want to
wrap the records into a new sheet.

Basically what I'm doing now is:

short rowNumber = 0;
HSSFRow r = mySheet.createRow(rowNumber);

while(rs.next())
{
  //write cells in row
  rowNumber++;
}

I figure I need to replace "rowNumber++" with a method to return the next
number or set "mySheet" to a new sheet and return 0 to start over, but I
can't figure out exactly how to do this.

Thanks in advance for any help,

Brian Glick
Freightek, Inc.
(215) 887-6100
b.glick@freightek.com

Re: Wrapping rows to a new sheet

Posted by Avik Sengupta <av...@apache.org>.
Something on the lines of :--
=======================================
short rowNumber = 0;
mySheet = workbook.createSheet();
HSSFRow r;  
 
while(rs.next())
{
   r = mySheet.createRow(rowNumber);
   //write cells in row
   rowNumber++;
   if (rowNumber > 65000) {
       mySheet=workbook.createSheet();
       rowNumber=0;
   }
}

==============================================
On Thu, 2003-01-09 at 21:41, Brian Glick wrote:
> Does anyone have a method to create a new sheet once you've exceeded the 65K
> row limit in a sheet?  I'm trying to run a 70,000 line report, and I want to
> wrap the records into a new sheet.
> 
> Basically what I'm doing now is:
> 
> short rowNumber = 0;
> HSSFRow r = mySheet.createRow(rowNumber);
> 
> while(rs.next())
> {
>   //write cells in row
>   rowNumber++;
> }
> 
> I figure I need to replace "rowNumber++" with a method to return the next
> number or set "mySheet" to a new sheet and return 0 to start over, but I
> can't figure out exactly how to do this.
> 
> Thanks in advance for any help,
> 
> Brian Glick
> Freightek, Inc.
> (215) 887-6100
> b.glick@freightek.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>