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: [email protected]
          Reporter: [email protected]
  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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to