Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > IRange Interface > Group Method : Group(ExcelGroupBy,Boolean) Method
Represents to expand the group by rows/columns.
Indicates whether group should be collapsed.

Group(ExcelGroupBy,Boolean) Method

Groups the Range by row/column with collapse flag.
Syntax
'Declaration
 
Overloads Function Group( _
   ByVal groupBy As ExcelGroupBy, _
   ByVal bCollapsed As Boolean _
) As IRange
'Usage
 
Dim instance As IRange
Dim groupBy As ExcelGroupBy
Dim bCollapsed As Boolean
Dim value As IRange
 
value = instance.Group(groupBy, bCollapsed)

Parameters

groupBy
Represents to expand the group by rows/columns.
bCollapsed
Indicates whether group should be collapsed.

Return Value

Returns the Range after grouping.
Example
The following code illustrates how to group the Range with collapse flag.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
    
//Group Rows
worksheet.Range["A1:A3"].Group(ExcelGroupBy.ByRows, true);
            
//Group Columns
worksheet.Range["A1:B1"].Group(ExcelGroupBy.ByColumns, false);
            
workbook.SaveAs("Grouping.xlsx");
workbook.Close();
excelEngine.Dispose();
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also