[Bug 64707] New: Editing existing XSSFTable without header corrupts xlsx

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Bug 64707] New: Editing existing XSSFTable without header corrupts xlsx

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

            Bug ID: 64707
           Summary: Editing existing XSSFTable without header corrupts
                    xlsx
           Product: POI
           Version: 4.1.x-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: XSSF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Editing a XSSFTable without header leads to a corrupted x

Steps to reproduce:
1) Create a XLSX with a XSSFTable and remove / hide the header.
2) Use Apache POI to open the XLSX file and add a few lines to the table
3) Adjust the AreaReference to cover all added data
4) Write XLSX and open in Excel

The method XSSFTable.updateHeaders() always updates the table headers
regardless of getHeaderRowCount().
Therefore it tries to write the first row of data into the header names.

Suggestion for a fix: XSSFTable::updateHeaders, line 821:
Extend the existing "if" with a check for getHeaderRowCount() > 0

 << if (row != null && row.getCTRow().validate()) {
 >> if (row != null && row.getCTRow().validate() && getHeaderRowCount() > 0) {

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