https://issues.apache.org/bugzilla/show_bug.cgi?id=47374





--- Comment #2 from Josh Micich <[email protected]>  2009-06-16 17:02:31 PST 
---
Your comment was:
Thanks for the bug-report and suggested fix.  So your proposed change was to
add the line "rowRecord.setColapsed(true);" in collapseRow(int):

    public void collapseRow(int rowNumber) {

        // Find the start of the group.
        int startRow = findStartOfRowOutlineGroup(rowNumber);
        RowRecord rowRecord = getRow(startRow);

+        rowRecord.setColapsed(true);
        // Hide all the columns until the end of the group
        int nextRowIx = writeHidden(rowRecord, startRow);


Unfortunately this is NQR.  I think we need to mark the previous row as
'collapsed', not the first row.

For example, with the following POI calls:

    sheet.setRowSumsBelow(false);
    sheet.groupRow(3, 5);
    sheet.setRowGroupCollapsed(3, true);

We should get the following 'outline levels' and flags in the rows:

2 ol=0 collapsed
3 ol=1 hidden
4 ol=1 hidden
5 ol=1 hidden

Currently POI does this:

3 ol=1 hidden
4 ol=1 hidden
5 ol=1 hidden
6 ol=0 collapsed
(Which is actually correct only if sheet.rowSumsBelow == true)

I've done some experimenting with how Excel collapses rows and it appears that
the row with the 'collapsed' flag should appear above *or* below the group
according to the state of the 'rowSumsBelow' flag on the sheet.  POI assumes
the 'collapsed' flag belongs on the group subsequent row which is wrong if
rowSumsBelow is false.

POI should also be changed so that the 'rowSumsBelow' property in HSSFSheet
gets coordinated with the underlying RowRecordsAggregate.  The
RowRecordsAggregate needs to know the value of this flag in order to find the
right row to update the 'collapsed' flag on.  Furthermore, when 'rowSumsBelow'
changes in the sheet, the RowRecordsAggregate will also need to transfer the
'collapsed' flags of each row group accordingly.


Note - Excel's overall model for collapsing row groups works OK as long as
every group has its own dedicated summary row (above or below).  It's not too
hard to create groups that have no summary row, and Excel behaves a little
weirdly in these cases.  POI probably shouldn't bother supporting such
anomalous use cases, and that should be mentioned in the javadoc.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to