Created attachment 33478 [details] Modified Template When the very first column of a template (blank) is removed, during report creation an XmlValueDisconnectedException occurs. Attached is the template version that is modified and causes the error. Notice that the very first column is not empty and is supposed to have output written to it... When there is a blank column "A", and the output is written from column "B", the error does not result. I was able to get around this issue by changing the template file format to .xls instead of .xlsx... Many times if the error was not caught, the .xsls report would need to be "repaired" before opening. When I looked into this further, it seems as though the XML tags for the sheet are being generated out of order. Ex: <row r="14" ht="15.75" customHeight="true"> ... </row> <row r="15" ht="15.75" customHeight="true"> ... </row> <row r="19"> ... </row> <row r="16" ht="15.75" customHeight="true"> ... </row> <row r="18" ht="15.75" customHeight="true"> ... </row> <row r="17" ht="15.75" customHeight="true"> ... </row> <row r="20" ht="15.75" customHeight="true"> ... </row> <row r="21" ht="15.75" customHeight="true"> ... </row> When the report generated had less than 200 rows, I was able to "repair" and open the report but rows would be removed from my results. When more data was to be returned, the XmlValueDisconnectException would result and report generation would fail.
This bug seems similar to https://bz.apache.org/bugzilla/show_bug.cgi?id=49940 but when I tried the latest version of POI the issue still remained...
You will need to provide some code-sample that shows how you reproduce the problem. Ideally as self-sufficient unit-test so somebody else can try to reproduce your problem.
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".
At least the issue with "collapsed" is fixed in bug #60541, closing this for now as it did hopefully also fix this issue. Please reopen or report a new issue if it still does not work for you with the latest version of Apache POI. *** This bug has been marked as a duplicate of bug 60541 ***