GroupBoxFormControl Interface
Group box form control.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
#Declaration
public interface GroupBoxFormControl :
FormControl,
Shape,
FloatingObject,
ShapeFormatBase,
TextFormControl,
ShadedFormControl
#Related API Members
The following members return GroupBoxFormControl objects:
#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 Form
#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:
- Access the item in the collection by its index
- Call the FormControlCollection.GetFormControlsByName method
- Call the FormControlCollection.GetFormControlById method
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
Shapenull
for Group
.
#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);
}