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

    RadioButtonFormControl Interface

    Radio button form control.

    Namespace: DevExpress.Spreadsheet

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

    NuGet Package: DevExpress.Spreadsheet.Core

    #Declaration

    public interface RadioButtonFormControl :
        FormControl,
        Shape,
        FloatingObject,
        ShapeFormatBase,
        TextFormControl,
        LinkedCellFormControl,
        ShadedFormControl

    #Remarks

    #Create a Button Form Control

    The code sample below creates a button form control:

    Workbook workbook = new Workbook();
    workbook.LoadDocument("Document.xlsx");
    
    var cellRange = workbook.Worksheets[0].Range["B2:C4"];
    var radioButtonFormControl = formControls.AddRadioButton(cellRange);
    radioButtonFormControl.PlainText = "Click Here";
    radioButtonFormControl.PrintObject = false;
    

    Note

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

    #Obtain Button 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 Id and Name properties return the form control’s identifier and name.

    #Modify Button Form Controls

    Use the RadioButtonFormControl class properties to change radio button parameters.

    Note

    The ShapeFormatBase.Fill and ShapeFormatBase.Outline properties return null for the ButtonFormControl.

    The code sample below retrieves all radio button form controls from a worksheet and disables printing for all buttons:

    using DevExpress.Spreadsheet;
    using System.Linq;
    
    Workbook workbook = new Workbook();
    workbook.LoadDocument("Document.xlsx");
    
    var formControls = workbook.Worksheets[0].FormControls;
    
    var radioButtons = formControls.Where(formControl => formControl.FormControlType == FormControlType.RadioButton).Cast<RadioButtonFormControl>();
    foreach (ButtonFormControl radioButton in radioButtons) {
        radioButton.PrintObject = false;
    }
    

    #Remove Button Form Controls

    Call the FormControlCollection.Remove or FormControlCollection.RemoveAt method to remove a form control.

    The code sample below removes all radio buttons 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.RadioButton)
            formControls.RemoveAt(i);
    }
    
    See Also