Hi -

I recently tried to read a huge Excel file using POI 3.6 and received
this Exception:
   IllegalArgumentException: Invalid row number (65536) outside
allowable range (0..65535).

I looked at the source and found the code for method
org.apache.poi.hssf.usermodel.HSSFRow.setRowNum() where the exception is
thrown:


    /**
     * set the row number of this row.
     * @param rowIndex  the row number (0-based)
     * @throws IndexOutOfBoundsException if the row number is not within
the range 0-65535.
     */
    public void setRowNum(int rowIndex) {
        int maxrow = SpreadsheetVersion.EXCEL97.getLastRowIndex();
        if ((rowIndex < 0) || (rowIndex > maxrow)) {
          throw new IllegalArgumentException("Invalid row number (" +
rowIndex
                  + ") outside allowable range (0.." + maxrow + ")");
        }
        rowNum = rowIndex;
        if (row != null) {
            row.setRowNumber(rowIndex);   // used only for KEY
comparison (HSSFRow)
        }
    }



My question is, is there a reason that the row limit is hard-coded to be
the limit for Excel 97 from
org.apache.poi.ss.SpreadsheetVersion.EXCEL97?  Is there something else
on the code that would fail if the limit from
org.apache.poi.ss.SpreadsheetVersion.EXCEL2007 were used?

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to