Bug 58927 - ColumnHelper.setColumnAttributes does not copy the "collapsed" field.
Summary: ColumnHelper.setColumnAttributes does not copy the "collapsed" field.
Status: NEEDINFO
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.14-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks: 58910
  Show dependency tree
 
Reported: 2016-01-28 03:29 UTC by Masaki Goto
Modified: 2016-03-13 02:08 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Masaki Goto 2016-01-28 03:29:51 UTC

    
Comment 1 Masaki Goto 2016-01-28 03:41:26 UTC
ColumnHelper#setColumnAttributes is called mainly when a new column is created by cloning existing columns.
However it does not clone correctly.

public void setColumnAttributes(CTCol fromCol, CTCol toCol) {
    if(fromCol.isSetBestFit()) toCol.setBestFit(fromCol.getBestFit());
    if(fromCol.isSetCustomWidth()) toCol.setCustomWidth(fromCol.getCustomWidth());
    if(fromCol.isSetHidden()) toCol.setHidden(fromCol.getHidden());
    if(fromCol.isSetStyle()) toCol.setStyle(fromCol.getStyle());
    if(fromCol.isSetWidth()) toCol.setWidth(fromCol.getWidth());
    if(fromCol.isSetCollapsed()) toCol.setCollapsed(fromCol.getCollapsed());
    if(fromCol.isSetPhonetic()) toCol.setPhonetic(fromCol.getPhonetic());
    if(fromCol.isSetOutlineLevel()) toCol.setOutlineLevel(fromCol.getOutlineLevel());
    toCol.setCollapsed(fromCol.isSetCollapsed());
}

If fromCol has "collapsed=0" (this means flomCol is not collapsed),
this method set "collapsed=1".
Comment 2 Javen O'Neal 2016-03-13 02:08:06 UTC
I think ColumnHelper operates on individual columns only (not column groups), and therefore doesn't deal with the higher-level column group collapsing concept. That logic probably belongs in XSSFSheet or in a different function in ColumnHelper that is column-group aware.

I haven't used setColumnAttributes, so if you're more familiar with it, explain what you think should be done.