https://bz.apache.org/bugzilla/show_bug.cgi?id=59795

            Bug ID: 59795
           Summary: XSSFTable needs a method to reset start/end Cell
                    References
           Product: POI
           Version: 3.15-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [email protected]
          Reporter: [email protected]

There is already a method, updateHeaders(), that resets most of the instance
computed/cached fields, but it doesn't unset the lazily evaluated start and end
cell references for the Table.  If you want to add or remove rows from a table
definition, you need to change the underlying CTTable object, and reset these
cached values in the XSSFTable wrapper.

Currently, the only way to hack this is to use reflection to get at the private
fields, which is not how we want to do it.

The easy fix is to just add:

public void updateReferences() {
    startCellReference = null;
    endCellReference = null;
}

The next time they are requested, they are re-computed from the underlying
(possibly updated) CTTable.

It is still up to the user to ensure the CTTable references match the data in
the worksheet.

I think this should be its own method, rather than just adding the two lines to
updateHeaders(), as there are distinct use cases for changing the headers of a
table and just adding/removing rows from a table.  No need to incur the
overhead of recomputing one when only the other is changing.

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