You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2010/04/27 09:04:06 UTC

DO NOT REPLY [Bug 49188] New: autoSizeColumn, ArrayOutOfBounds if more than Short.MAX_VAULE rows

https://issues.apache.org/bugzilla/show_bug.cgi?id=49188

           Summary: autoSizeColumn, ArrayOutOfBounds if more than
                    Short.MAX_VAULE rows
           Product: POI
           Version: 3.6
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: al@linova.de


Created a worksheet with more tham Short.MAX_VALUE rows and 3 columns.
Called HSSFSheet.autoSizeColumn on each of the three columns, which caused the
exception below. Auto sizing works when number of rows is lower than
Short.MAX_VALUE

java.lang.ArrayIndexOutOfBoundsException: -32735
    at java.util.ArrayList.get(Unknown Source)
    at
org.apache.poi.hssf.model.WorkbookRecordList.get(WorkbookRecordList.java:50)
    at org.apache.poi.hssf.model.Workbook.getExFormatAt(Workbook.java:787)
    at org.apache.poi.hssf.usermodel.HSSFCell.getCellStyle(HSSFCell.java:906)
    at
org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:1727)
    at
org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:1662)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49188] autoSizeColumn, ArrayOutOfBounds if more than Short.MAX_VAULE rows

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49188

--- Comment #3 from Yegor Kozlov <ye...@dinom.ru> 2011-02-10 08:43:53 EST ---
The maximum number of cell styles in a workbook is 4000, see
http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP005199291.aspx

Cell Styles must be shared. Do not create per-cell, otherwise you will get a
“Too many styles” error in Excel when opening your workbook. Think of Cell
Styles like CSS and create them like that.

http://poi.apache.org/faq.html#faq-N100EF

Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49188] autoSizeColumn, ArrayOutOfBounds if more than Short.MAX_VAULE rows

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49188

Bhalchandra <b_...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major

--- Comment #2 from Bhalchandra <b_...@yahoo.com> 2011-02-10 07:13:37 EST ---

following code is failing with same exception : 

    public static void main(String[] args) throws Exception {
        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sh = wb.createSheet();
        for (int i = 0; i < 65535; i++) {
            HSSFRow row = sh.createRow(i);
            for (int j = 0; j < 3; j++) {
                CellStyle cellStyle = wb.createCellStyle();
                CreationHelper createHelper = wb.getCreationHelper();
               
cellStyle.setDataFormat(createHelper.createDataFormat().getFormat("m/d/yy
h:mm"));
                HSSFCell cell = row.createCell(j);
                cell.setCellStyle(cellStyle);
                Date date = new Date();
                cell.setCellValue("cell[" + i + "," + j + "]");
            }
        }
        for (int j = 0; j < 5; j++) {
            sh.autoSizeColumn(j);
        }
        FileOutputStream fileOut;
        try {
            fileOut = new FileOutputStream("workbook_MaxLimitTest4.xls");
            wb.write(fileOut);
            fileOut.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        catch (IOException ie) {
            ie.printStackTrace();
        }
        System.out.println("Done");
    }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49188] autoSizeColumn, ArrayOutOfBounds if more than Short.MAX_VAULE rows

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49188

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |INVALID

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49188] autoSizeColumn, ArrayOutOfBounds if more than Short.MAX_VAULE rows

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49188

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2010-05-22 15:34:01 EDT ---
Please post sample code to reproduce the problem.

The following code works fine to me:

    public static void main(String[] args) throws Exception {
        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sh = wb.createSheet();
        for (int i = 0; i < Short.MAX_VALUE + 5; i++) {
            HSSFRow row = sh.createRow(i);
            for (int j = 0; j < 3; j++) {
                HSSFCell cell = row.createCell(j);
                cell.setCellValue("cell[" + i + "," + j + "]");
            }
        }
        for (int j = 0; j < 5; j++) {
            sh.autoSizeColumn(j);
        }
    }

Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 49188] autoSizeColumn, ArrayOutOfBounds if more than Short.MAX_VAULE rows

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49188

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stormbringer@mail.com

--- Comment #4 from Yegor Kozlov <ye...@dinom.ru> 2011-03-03 03:57:48 EST ---
*** Bug 50853 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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