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 2012/05/09 21:32:09 UTC

[Bug 53209] New: Too many styles corrupts the excel

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

          Priority: P2
            Bug ID: 53209
          Assignee: dev@poi.apache.org
           Summary: Too many styles corrupts the excel
          Severity: normal
    Classification: Unclassified
          Reporter: awm@mbcli.com
          Hardware: PC
            Status: NEW
           Version: 3.8
         Component: XSSF
           Product: POI

Having a 3250 rows x 10 cells for each row seem to be the limit the number of
styles.

3500 x 10 breaks the excel file. 

Attached is a set of files/code to replicate the issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53209] Too many styles corrupts the excel

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

--- Comment #3 from Nikel <nk...@gmail.com> ---
According to http://msdn.microsoft.com/en-us/library/office/ff700514.aspx the
maximum number of styles for Excel 2010 is 64000 .

-- 
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


Re: [Bug 53209] Too many styles corrupts the excel

Posted by Aram Mirzadeh <aw...@apache.org>.
Okay, I see the rookie mistake I made.

Thanks.

Sorry about the bug report.  You can close it out.

Aram

On 5/9/2012 7:04 PM, Aram Mirzadeh wrote:
>
> Hi,
>
> But does that number apply to the "number" of styles defined, or the 
> number of times the style is applied?
>
> The code only defines about a dozen styles.  I simply just applied the 
> same style to all cells.
>
> Aram
>
> On 5/9/2012 5:35 PM, bugzilla@apache.org wrote:
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=53209
>>
>> Nick Burch<ni...@alfresco.com>  changed:
>>
>>             What    |Removed                     |Added
>> ---------------------------------------------------------------------------- 
>>
>>               Status|NEW                         |NEEDINFO
>>                   OS|                            |All
>>
>> --- Comment #2 from Nick Burch<ni...@alfresco.com>  ---
>> In HSSF, we have a maximum number of styles, and throw an exception 
>> if someone
>> tries to add more than that
>>
>>      /**
>>       * The maximum number of cell styles in a .xls workbook.
>>       * The 'official' limit is 4,000, but POI allows a slightly 
>> larger number.
>>       * This extra delta takes into account built-in styles that are
>> automatically
>>       * created for new workbooks
>>       *
>>       * See
>> http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP005199291.aspx 
>>
>>       */
>>      private static final int MAX_STYLES = 4030;
>>
>> The .xlsx file format also has a maximum number of styles, but it 
>> doesn't look
>> like we enforce that in the same way. From a quick check, neither
>> XSSFWorkbook.createCellStyle() nor StylesTable appears to have the check
>>
>> The fix is probably for someone to dig out the official maximum 
>> number of
>> styles in a .xlsx file, from the file format docs, then implement a 
>> similar
>> check in xssf
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org


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


Re: [Bug 53209] Too many styles corrupts the excel

Posted by Aram Mirzadeh <aw...@mbcli.com>.
Hi,

But does that number apply to the "number" of styles defined, or the 
number of times the style is applied?

The code only defines about a dozen styles.  I simply just applied the 
same style to all cells.

Aram

On 5/9/2012 5:35 PM, bugzilla@apache.org wrote:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=53209
>
> Nick Burch<ni...@alfresco.com>  changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>               Status|NEW                         |NEEDINFO
>                   OS|                            |All
>
> --- Comment #2 from Nick Burch<ni...@alfresco.com>  ---
> In HSSF, we have a maximum number of styles, and throw an exception if someone
> tries to add more than that
>
>      /**
>       * The maximum number of cell styles in a .xls workbook.
>       * The 'official' limit is 4,000, but POI allows a slightly larger number.
>       * This extra delta takes into account built-in styles that are
> automatically
>       * created for new workbooks
>       *
>       * See
> http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP005199291.aspx
>       */
>      private static final int MAX_STYLES = 4030;
>
> The .xlsx file format also has a maximum number of styles, but it doesn't look
> like we enforce that in the same way. From a quick check, neither
> XSSFWorkbook.createCellStyle() nor StylesTable appears to have the check
>
> The fix is probably for someone to dig out the official maximum number of
> styles in a .xlsx file, from the file format docs, then implement a similar
> check in xssf
>


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


[Bug 53209] Too many styles corrupts the excel

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

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

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

--- Comment #2 from Nick Burch <ni...@alfresco.com> ---
In HSSF, we have a maximum number of styles, and throw an exception if someone
tries to add more than that

    /**
     * The maximum number of cell styles in a .xls workbook.
     * The 'official' limit is 4,000, but POI allows a slightly larger number.
     * This extra delta takes into account built-in styles that are
automatically
     * created for new workbooks
     *
     * See
http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP005199291.aspx
     */
    private static final int MAX_STYLES = 4030;

The .xlsx file format also has a maximum number of styles, but it doesn't look
like we enforce that in the same way. From a quick check, neither
XSSFWorkbook.createCellStyle() nor StylesTable appears to have the check

The fix is probably for someone to dig out the official maximum number of
styles in a .xlsx file, from the file format docs, then implement a similar
check in xssf

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53209] Too many styles corrupts the excel

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

--- Comment #1 from awm@mbcli.com ---
Created attachment 28750
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28750&action=edit
java code and excel template to reproduce the error

-- 
You are receiving this mail because:
You are the assignee for the bug.