Bug 58466

Summary: ColumnHelper.addCleanColIntoCols() loses information in some overlapping-column cases
Product: POI Reporter: Chris Boyle <cmb-apache>
Component: XSSFAssignee: POI Developers List <dev>
Severity: normal CC: onealj
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: More tests of ColumnHelper, 2 of which fail

Description Chris Boyle 2015-09-29 17:00:30 UTC
Created attachment 33151 [details]
More tests of ColumnHelper, 2 of which fail

I attach a patch adding some more tests of ColumnHelper, 2 of which fail:

* testAddCleanColIntoColsExactOverlap
  * Adds CTCol(min=1, max=1, hidden=true)
  * Adds CTCol(min=1, max=1, bestFit=true)
  * Expected: CTCol(min=1, max=1, hidden=true, bestFit=true)
  * Actual:   CTCol(min=1, max=1, hidden=true)

* testAddCleanColIntoColsNewOverlapsOverhangingLeftNotRightExactRight:
  * Adds CTCol(min=2 max=3 hidden=true)
  * Adds CTCol(min=1 max=3 bestFit=true)
    * Note that a sort happens, meaning 1-3 is encountered first in the combine operation.
  * Expected: (min=1, max=1, bestFit=true), (min=2, max=3, bestFit=true, hidden=true)
  * Actual:   (min=1, max=1, bestFit=true), (min=2, max=3, bestFit=true)

We have our own different implementation of a fast column merger which passes these; it pre-dates trunk's current implementation introduced in r1561435 under bug 54283. We can look at contributing our replacement if that's easier than fixing the current implementation.
Comment 1 David North 2015-10-05 10:33:10 UTC
As discussed at ApacheCon, replaced the fix from bug 54283 with our implementation; this appears to work better and has improved the behaviour of column group collapsing too (made it closer to what Excel does).

Fixed in SVN r1706789

Thanks to Chris, and to Matt Hillsdon, for their work on this one.
Comment 2 Javen O'Neal 2015-10-08 04:40:04 UTC
I got some weird errors from the changes in r1706789. For example, XSSFSheet.autoSizeColumn(col) changes the size of col and an adjacent column. In some cases, autoSizeColumn ended up hiding columns that were previously visible.

I'll see if I can pair down my Excel template to a SSCCE. Right now I can't reproduce the problem if I start with a blank workbook.