A radio button cell is a cell that displays a radio button (or option button) list. You can specify the list of options and specify whether to display the list horizontally or vertically. By default, the list displays horizontally in the cell. To display the list vertically, set the RepeatDirection property to Vertical. Use the Values property to add the list of options.
The following figures display the horizontal and vertical directions.
Spread does not support radio buttons without labels; each radio button must have a label. |
To create a cell that displays a radio button list, follow the procedure described below.
For details on the properties and methods for this cell type, refer to the RadioButtonListCellType class in the Assembly Reference.
Using Code
- Set the size of the cell (or column) to fit the list of options.
- Define the radio button list cell type by creating an instance of the RadioButtonListCellType class.
- Specify the list of options.
- Set the display properties of the cell.
- Assign the radio button list cell type to a specific cell.
Example
Display the vertical list of colors as radio buttons.
C# | Copy Code |
---|---|
FpSpread1.ActiveSheetView.Columns[1].Width = 250; string[] rbval; rbstr = new String[] {"Red", "Green", "Blue"}; rbval = new String[] {"R", "G", "B"}; FarPoint.Web.Spread.RadioButtonListCellType rblct = new FarPoint.Web.Spread.RadioButtonListCellType(rbstr); rblct.Values = rbval; rblct.RepeatDirection = RepeatDirection.Vertical; FpSpread1.ActiveSheetView.Cells[1, 1].CellType = rblct; |
VB | Copy Code |
---|---|
FpSpread1.ActiveSheetView.Columns(1).Width = 250 Dim rbstr As String() Dim rbval As String() rbstr = New String() {"Red", "Green", "Blue"} rbval = New String() {"R", "G", "B"} Dim rblct As New FarPoint.Web.Spread.RadioButtonListCellType(rbstr) rblct.Values = rbval rblct.RepeatDirection = RepeatDirection.Vertical FpSpread1.ActiveSheetView.Cells(1, 1).CellType = rblct |
Using the Spread Designer
- In the work area, select the cell or cells for which you want to set the cell type.
- Select the Home menu.
- Select the SetCellType icon under the CellType section.
- Select the cell type and any other cell properties.
- Select OK to close the dialog.
- Click Apply and Exit to close the Spread Designer.