menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class CollapseAllGroupCommand - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class CollapseAllGroupCommand

    Collapses or Expands the group by rows/columns based on the outlinelevel value

    Inheritance
    System.Object
    CommandBase
    OutlineCommand
    CollapseAllGroupCommand
    Implements
    ICommand
    Inherited Members
    CommandBase.CanExecute(Object)
    CommandBase.CommandName
    CommandBase.Execute(Object)
    CommandBase.SfSpreadsheet
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Windows.Forms.Spreadsheet.Commands
    Assembly: Syncfusion.Spreadsheet.Windows.dll
    Syntax
    public class CollapseAllGroupCommand : OutlineCommand, ICommand
    Examples

    The following code illustrates how to collapse and expand the group in the Sfspreadsheet

    //Collapse group
    spreadsheet.ActiveSheet.Range["A3:A6"].CollapseGroup(ExcelGroupBy.ByRows);
    spreadsheet.ActiveGrid.RowHeights.SetHidden(3, 6, true);
    spreadsheet.RefreshOutlines(true, false);
    spreadsheet.ActiveGrid.InvalidateCells();
    
    //Expand group
    spreadsheet.ActiveSheet.Range["A3:A6"].ExpandGroup(ExcelGroupBy.ByRows);
    spreadsheet.ActiveGrid.RowHeights.SetHidden(3, 6, false);
    spreadsheet.RefreshOutlines(true, false);
    spreadsheet.ActiveGrid.InvalidateCells();

    Constructors

    CollapseAllGroupCommand(Spreadsheet, Int32, ExcelGroupBy, IWorksheet)

    Initializes a new instance of CollapseAllGroupCommand class

    Declaration
    public CollapseAllGroupCommand(Spreadsheet SfSpreadsheet, int labelNo, ExcelGroupBy groupBy, IWorksheet workSheet)
    Parameters
    Type Name Description
    Spreadsheet SfSpreadsheet

    An instance of

    System.Int32 labelNo

    Outlinelevel value

    ExcelGroupBy groupBy

    Group Type

    IWorksheet workSheet

    An instance of IWorksheet

    Methods

    OnCanExecute(Object)

    Determines whether the CollapseAllGroupCommand Can be executed or not

    Declaration
    public override bool OnCanExecute(object parameter)
    Parameters
    Type Name Description
    System.Object parameter

    True or False

    Returns
    Type Description
    System.Boolean

    True or False

    Overrides
    OutlineCommand.OnCanExecute(Object)
    Remarks

    This command cannot be executed if the worksheet is protected

    OnExecute(Object)

    Executes the CollapseAllGroupCommand

    Declaration
    protected override void OnExecute(object parameter)
    Parameters
    Type Name Description
    System.Object parameter

    null

    Overrides
    OutlineCommand.OnExecute(Object)

    Implements

    ICommand
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved