Bug 55248 - public interface Sheet - showInPane - parameter in short data type limiting the toprow at 32767
Summary: public interface Sheet - showInPane - parameter in short data type limiting t...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.8-FINAL
Hardware: PC Mac OS X 10.4
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL: http://stackoverflow.com/questions/17...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-12 02:36 UTC by Phil
Modified: 2013-07-13 05:37 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil 2013-07-12 02:36:52 UTC
I am making an excel file using Apache POI library. After creating an excel file with more than 32767 rows, I can't set showInPane because of toprow parameter in short data type. When I pass more than 32767 row as a variable, it gives me an error.

java.lang.IllegalArgumentException: row index may not be negative
    at org.apache.poi.ss.util.CellReference.<init>(CellReference.java:133)
    at org.apache.poi.ss.util.CellReference.<init>(CellReference.java:127)
    at org.apache.poi.ss.util.CellReference.<init>(CellReference.java:119)
    at org.apache.poi.xssf.usermodel.XSSFSheet.showInPane(XSSFSheet.java:2380)
Is there any way I can set the toprow overriding short data type maximum value?

showInPane from Apache Javadoc

void showInPane(short toprow, short leftcol)
    Sets desktop window pane display area, when the file is first opened in a viewer.
Parameters:
    toprow - the top row to show in desktop window pane
    leftcol - the left column to show in desktop window pane

http://stackoverflow.com/questions/17586245/apache-poi-showinpane-parameter-in-short-data-type
Comment 1 Dominik Stadler 2013-07-12 19:50:09 UTC
I have a fix for this available locally, but would like to keep it out of SVN until we have released POI 3.10 in order to not cause issues with binary compatibility any more between beta and final release. 

Please ping this Bug if it is not resolved after POI 3.10 is released.
Comment 2 Nick Burch 2013-07-12 20:23:09 UTC
Dominik - I'd suggest we add a new method with an int signature, and @deprecate the short one. That should let us maintain the backwards compatibility, whilst allowing people to opt-in (via an int not a short) to the fixed one
Comment 3 Dominik Stadler 2013-07-13 05:37:52 UTC
Ok, that's exactly what I was planning to do, I thought it might cause problems when people are using showInPane() with numerals, but I did some more checks now and it seems this cannot happen as e.g. "0" is an int, not short in Java and you need to cast it to short anyway.

This is now checked in for POI 3.10.