You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2012/10/31 18:06:10 UTC

[Bug 54082] New: collapseRow do not works as expected

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

          Priority: P2
            Bug ID: 54082
          Assignee: dev@poi.apache.org
           Summary: collapseRow do not works as expected
          Severity: normal
    Classification: Unclassified
          Reporter: michele.croci@immopac.ch
          Hardware: PC
            Status: NEW
           Version: 3.8
         Component: XSSF
           Product: POI

Created attachment 29536
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29536&action=edit
Output

I have a nested grouping with one parent and two children. 
The first level is expanded. The first child is expanded and the second one
collapsed. I expand/collapse the groups using setRowGroupCollapsed. The problem
is that if I set the second child as NOT expanded, the first one is also closed
(see attachment)




Here the code:


import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;


public class ExcelGroupRowTest {

    /**
     * @param args
     */
    public static void main(String[] args) {
        try{
        Workbook wb = new XSSFWorkbook();
        Sheet sheet = wb.createSheet("Mysheet");
        sheet.groupRow(1, 20);
        sheet.setRowGroupCollapsed(1, false);

        sheet.groupRow(5, 10);
        sheet.setRowGroupCollapsed(5, false);


        sheet.groupRow(12, 14);
        sheet.setRowGroupCollapsed(12, true);

    FileOutputStream fileOut = new FileOutputStream("workbook.xlsx");
            wb.write(fileOut);
            fileOut.close();
        }catch (IOException e){

            e.printStackTrace();
        }

    }

}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 54082] collapseRow do not works as expected

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54082

michele.croci@immopac.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from michele.croci@immopac.ch ---
I have looked at the source code, one possible patch would be to modify the
writeHidden method in this way:


    private int writeHidden(XSSFRow xRow, int rowIndex, boolean hidden) {
      int level = xRow.getCTRow().getOutlineLevel();
      int currentRow;
      for (currentRow = rowIndex; currentRow < getLastRowNum(); currentRow++) {
          if (getRow(currentRow) == null
                  || getRow(currentRow).getCTRow().getOutlineLevel() < level) {
              break;
          }else{
              getRow(currentRow).getCTRow().setHidden(hidden);
          }
      }
      return currentRow;
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 54082] collapseRow do not works as expected

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54082

Dmitry Smirnov <dm...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |richardjusko@gmail.com

--- Comment #2 from Dmitry Smirnov <dm...@gmail.com> ---
*** Bug 53582 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 54082] collapseRow do not works as expected

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54082

michele.croci@immopac.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michele.croci@immopac.ch

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org