Skip to main content
All docs
V25.1
  • Row

    DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

    Take the survey Not interested

    GroupBoxFormControl Interface

    Group box form control.

    Namespace: DevExpress.Spreadsheet

    Assembly: DevExpress.Spreadsheet.v25.1.Core.dll

    NuGet Package: DevExpress.Spreadsheet.Core

    #Declaration

    public interface GroupBoxFormControl :
        FormControl,
        Shape,
        FloatingObject,
        ShapeFormatBase,
        TextFormControl,
        ShadedFormControl

    #Remarks

    #Create a Group Box Form Control

    The code sample below creates a group box control:

    using DevExpress.Spreadsheet;
    
    Workbook workbook = new Workbook();
    workbook.LoadDocument("Document.xlsx");
    
    var cellRange = workbook.Worksheets[0].Range["B2:F6"];
    var groupBox = formControls.AddGroupBox(cellRange);
    groupBox.PlainText = "Group Box";
    

    Note

    The FormControlCollection.AddGroupBox method call adds a new item to both FormControlCollection and ShapeCollection.

    #Obtain Group Box Form Controls

    The Worksheet.FormControls property obtains all form controls in a worksheet. You can use one of the following ways to obtain a specific form control:

    The FormControl.Id and FormControl.Name properties return the form control’s identifier and name.

    #Modify Group Box Form Controls

    Use the GroupBoxFormControl class properties to change group box parameters. The code sample below obtains all group boxes and enables 3D shading:

    using DevExpress.Spreadsheet;
    using System.Linq;
    
    Workbook workbook = new Workbook();
    workbook.LoadDocument("Document.xlsx");
    
    var formControls = workbook.Worksheets[0].FormControls;
    
    var groupBoxes = formControls.Where(formControl => formControl.FormControlType == FormControlType.GroupBox).Cast<GroupBoxFormControl>();
    foreach (GroupBoxFormControl groupBox in groupBoxes)
    {
        groupBox.Shading3D = true;
    
    }
    

    Note

    ShapeFormatBase.Fill, ShapeFormatBase.Outline property returns null for GroupBoxFormControl.

    #Remove Group Box Controls

    Call the FormControlCollection.Remove or FormControlCollection.RemoveAt method to remove a form control. The FormControlCollection.Clear() method removes all form controls from a worksheet.

    The code sample below removes all group boxes from a worksheet:

    Workbook workbook = new Workbook();
    workbook.LoadDocument("Document.xlsx");
    
    var formControls = workbook.Worksheets[0].FormControls;
    
    for (int i = formControls.Count - 1; i >= 0; i--) {
        if (formControls[i].FormControlType == FormControlType.GroupBox)
            formControls.RemoveAt(i);
    }
    
    See Also