Bug 58910 - org.apache.xmlbeans.impl.values.XmlValueDisconnectedException when first column removed from template
Summary: org.apache.xmlbeans.impl.values.XmlValueDisconnectedException when first colu...
Status: RESOLVED DUPLICATE of bug 60541
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.14-dev
Hardware: All Mac OS X 10.4
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on: 58927
Blocks:
  Show dependency tree
 
Reported: 2016-01-22 13:01 UTC by Brendan
Modified: 2022-12-26 10:00 UTC (History)
0 users



Attachments
Modified Template (16.58 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2016-01-22 13:01 UTC, Brendan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brendan 2016-01-22 13:01:27 UTC
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.
Comment 1 Brendan 2016-01-22 13:02:47 UTC
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...
Comment 2 Dominik Stadler 2016-01-22 13:47:31 UTC
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.
Comment 3 Masaki Goto 2016-01-28 03:39:18 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 4 Dominik Stadler 2022-12-26 10:00:30 UTC
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 ***