We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Collapsing Certain Level of Groups

Hello,

Is it possible to collapse certain levels of groups? For example, collapse all groups that are 2nd level+?

I.e., collapsing all 2nd level+ groups would look like this:
image.png (1.6 KB)

Thanks.

@danilolekovic,
We are analyzing this requirement and will share our feedback soon.

@danilolekovic,

Please refer to and try the following sample code with template file (attached) to accomplish your task:
e.g.
Sample code:

Workbook book = new Workbook("e:\\test2\\book.xlsx");
            Worksheet sheet = book.Worksheets[0];

            for (int i = 0; i <= sheet.Cells.MaxRow; i++)
            {

                int rowOutlineLevel = sheet.Cells.GetGroupedRowOutlineLevel(i);
                if (rowOutlineLevel > 1)
                {

                    sheet.Cells.HideGroupDetail(true, i);
                }
            }
            book.Save("e:\\test2\\out1.xlsx");

Also, find attached the output file for your reference.

Hope, this helps a bit.
files1.zip (18.4 KB)

1 Like