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