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 2016/07/04 16:47:09 UTC

[Bug 59795] New: XSSFTable needs a method to reset start/end Cell References

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: dev@poi.apache.org
          Reporter: greg.woolsey@gmail.com

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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 59795] XSSFTable needs a method to reset start/end Cell References

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

--- Comment #3 from Javen O'Neal <on...@apache.org> ---
(In reply to Javen O'Neal from comment #1)
> I noticed that getRowCount returns toRow-fromRow. Shouldn't it be
> toRow-fromRow+1?
Spun off getRowCount fix to bug 59796

> (on a US holiday, no less - if that's where you are).
2 hour road trip was a perfect opportunity to get these fixes in. I'm glad to
have an XSSFTable expert to help this class mature (hoping to make getCTTable
protected in the future).

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


[Bug 59795] XSSFTable needs a method to reset start/end Cell References

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

--- Comment #4 from Greg Woolsey <gr...@gmail.com> ---
(In reply to Javen O'Neal from comment #3)
> (hoping to make getCTTable protected in the future).

That will require some more code.  Right now I'm trying to figure out how to
get the QueryTable related to a Table, so I can get the Connection for the
QueryTable and then eventually have Java perform queries previously done by
ODBC/ADO (that will be custom code, not part of POI, but the document object
links are arcane and not documented).

Learning about the OPCPackage, PackagePart, and POIXMLDocumentPart classes.

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


[Bug 59795] XSSFTable needs a method to reset start/end Cell References

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

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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


[Bug 59795] XSSFTable needs a method to reset start/end Cell References

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

Javen O'Neal <on...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Javen O'Neal <on...@apache.org> ---
Applied in r1751368 with a corresponding unit test and updated documentation.

I noticed that getRowCount returns toRow-fromRow. Shouldn't it be
toRow-fromRow+1?

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


[Bug 59795] XSSFTable needs a method to reset start/end Cell References

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

--- Comment #2 from Greg Woolsey <gr...@gmail.com> ---
(In reply to Javen O'Neal from comment #1)
> Applied in r1751368 with a corresponding unit test and updated documentation.
> 
> I noticed that getRowCount returns toRow-fromRow. Shouldn't it be
> toRow-fromRow+1?

Good catch, yes, I think it should.  Thanks for the quick turn around! (on a US
holiday, no less - if that's where you are).

Doesn't look like many people are using Tables yet in XSSF workbooks - maybe
because the formula syntax didn't work until the recent flurry of changes we
made.

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