You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Andrea Nenni <An...@methodpark.de> on 2004/01/27 12:57:07 UTC

[PATCH] wrong lastrow entry in HSSF sheet

Hi POI developers,

I'd like to submit a patch. I've attached the "diff -u" for

org/apache/poi/hssf/model/Sheet.java

to this e-mail. I diffed against the latest release poi-2.0-final-200401262,
not against cvs HEAD. I hope that this is no problem, since it's just a very
small (one character) patch.

I had the problem that the lastrow entry in the DimensionsRecord didn't seem

to be set correctly for sheets with even row numbers. (These sheets could
not 
be read correctly by MS Project.)

This is caused by the method Sheet.addRow(RowRecord) which increments the 
lastrow entry only on every second call:

 if (row.getRowNumber() > d.getLastRow())
 {
    d.setLastRow(row.getRowNumber() + 1);
 }

As the lastRow in the DimensionsRecord "d" is counted starting from 1
and the rowNumber in the RowRecord "row" is counted starting from 0, 
the correct if-condition must be ">=", not ">".  

I hope my patch is useful and hasn't got any ugly side effects.

Thanks for working so hard on POI.

Greetings,
Andrea Nenni

 


Re: [PATCH] wrong lastrow entry in HSSF sheet

Posted by Avik Sengupta <av...@itellix.com>.
Thanks a lot. Would you mind adding this to bugzilla?
http://nagoya.apache.org/bugzilla/

Would be a great help, it risks getting lost in the pile among the
hundreds of mails we recieve everyday, unless someone patches it
immediately, which is unlikely.  

Thanks again for your help. 

Regards
-
Avik


On Tue, 2004-01-27 at 17:27, Andrea Nenni wrote:
> Hi POI developers,
> 
> I'd like to submit a patch. I've attached the "diff -u" for
> 
> org/apache/poi/hssf/model/Sheet.java
> 
> to this e-mail. I diffed against the latest release poi-2.0-final-200401262,
> not against cvs HEAD. I hope that this is no problem, since it's just a very
> small (one character) patch.
> 
> I had the problem that the lastrow entry in the DimensionsRecord didn't seem
> 
> to be set correctly for sheets with even row numbers. (These sheets could
> not 
> be read correctly by MS Project.)
> 
> This is caused by the method Sheet.addRow(RowRecord) which increments the 
> lastrow entry only on every second call:
> 
>  if (row.getRowNumber() > d.getLastRow())
>  {
>     d.setLastRow(row.getRowNumber() + 1);
>  }
> 
> As the lastRow in the DimensionsRecord "d" is counted starting from 1
> and the rowNumber in the RowRecord "row" is counted starting from 0, 
> the correct if-condition must be ">=", not ">".  
> 
> I hope my patch is useful and hasn't got any ugly side effects.
> 
> Thanks for working so hard on POI.
> 
> Greetings,
> Andrea Nenni
> 
>  
> 
> 
> ______________________________________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org