I figured it out...

That's the code I tried first, but since the row number is defined as a
short, line 32768 is really -32768 and line 32769 is really -32767.  Line
65535 = 0.  

What I ended up doing is changing the if statement to:

if(rowNumber < 0 && rowNumber > -2)

This will return true at line 65534 (which is close enough to the end for my
purposes.)

Thanks for your help.

Brian Glick
Freightek, Inc.
(215) 887-6100
[EMAIL PROTECTED]

-----Original Message-----
From: Avik Sengupta [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 09, 2003 11:43 AM
To: POI Users List
Subject: Re: Wrapping rows to a new sheet

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
> [EMAIL PROTECTED]
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 




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

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

Reply via email to