URGENT : Collapse Expand grouping

How to expand or collapse all groupings in aspose.total for .NET?


This message was posted using Aspose.Live 2 Forum

Hi,

Please see the document:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/groupingungrouping-rows-and-columns.html

You may use Cells.GroupRows(firstIndex, lastIndex, isHidden) —> put true or false to make the collapsed or expanded.

Thank you.

Thanks Amjad for your response. Presume the grouping is already done by a different process based on some logic and my grouping is not collapsed and remains expanded.

now, I would like to collapse all the groupings with out bothering about the indices.

I would want to do this functionality simlar to the one below:

Cells.Groups.All.Expand() or Cells.Groups.All.Collapse()

The grouping gets expanded automatically because of the other formatting which happens post the group rows - I have no control on the grouping logic as it is done by a separate application.

Is there any work around or what would cause a grouping to expand automatically and have it collapsed all the time?

Regards,

Pradeep

Hi,

Well, I think you may try to use HideGroupDetail and ShowGroupDetail methods of Worksheet.Cells object, see the sample code below:


Workbook book = new Workbook(“e:\test\Book1.xls”);
Worksheet sheet = book.Worksheets[0];

for(int i = 0; i<= sheet.Cells.MaxRow;i++)
{
//Collapse all the grouped rows.
sheet.Cells.HideGroupDetail(true, i);

}
book.Save(“e:\test\outBook1.xls”);


Thank you.