[Bug 63152] New: Too many identical CellStyles cause .xls to be incorrectly rendered in Office 365

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 63152] New: Too many identical CellStyles cause .xls to be incorrectly rendered in Office 365

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63152

            Bug ID: 63152
           Summary: Too many identical CellStyles cause .xls to be
                    incorrectly rendered in Office 365
           Product: POI
           Version: 4.0.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Created attachment 36429
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36429&action=edit
A test case to reproduce the issue

Please find a reproducer in attachment.
This is with Java 11 and POI 4.0.1.

When I create too many identical CellStyle instances, Office 365 only applies
the first X of them. For example, the reproducer creates the same CellStyle for
44 Cells. However, in Office 365, only the first 43 have the CellStyle applied.
Note that LibreOffice 6.1.4.2 renders this correctly. I don't have older
versions of Office available, to see how they render the file.

In the reproducer there are 2 workarounds/hacks I found:
1) apply HSSFOptimiser.optimiseCellStyles(wb); before saving the Workbook
2) make each CellStyle different by creating a new Font for each:
style.setFont(wb.createFont());

What I would like, is that POI throws an Exception at some point (I propose
some kind of IOException upon Workbook.write), when there are too many
identical CellStyles. The exception message could then explain that Office 365
won't properly render the file, and that it's best to properly manage
CellStyles by creating "logical CellStyles", but that a quick workaround is to
invoke HSSFOptimiser.optimiseCellStyles just before saving the file.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63152] Too many identical CellStyles cause .xls to be incorrectly rendered in Office 365

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63152

Dominik Stadler <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63152] Too many identical CellStyles cause .xls to be incorrectly rendered in Office 365

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63152

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 63152] Too many identical CellStyles cause .xls to be incorrectly rendered in Office 365

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=63152

--- Comment #1 from [hidden email] ---
Created attachment 36766
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36766&action=edit
Another test case with style changes and SXSSF

An example which shows that even if the style changes, they are not rendered
properly for HSSFWorksheet and confirmation that they are rendered properly for
SXSSFWorksheet.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]