Interface IOptionButtonShape
This interface represents TextBox form control shape.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Portable.dll
Syntax
public interface IOptionButtonShape : ITextBoxShape, ITextBox, IShape, IParentApplication
Properties
CheckState
Indicates whether option button is checked.
Declaration
ExcelCheckState CheckState { get; set; }
Property Value
Type |
---|
ExcelCheckState |
Examples
By default, Unchecked is set to CheckState
property. Here for example, we add two IOptionButtonShape
and set Checked to CheckState
.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add option buttons
IOptionButtonShape optionButton1 = worksheet.OptionButtons.AddOptionButton();
IOptionButtonShape optionButton2 = worksheet.OptionButtons.AddOptionButton();
//Set text
optionButton1.Text = "Option1";
optionButton2.Text = "Option2";
//Set dimensions
optionButton1.Left = 60;
optionButton1.Top = 40;
optionButton1.Width = 100;
optionButton1.Height = 30;
optionButton2.Left = 160;
optionButton2.Top = 40;
optionButton2.Width = 100;
optionButton2.Height = 30;
//Set linked cell
optionButton1.LinkedCell = worksheet["$C$7"];
//Set state
optionButton1.CheckState = ExcelCheckState.Checked;
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
}
Display3DShading
Gets or sets value indicating whether 3D shadow is present.
Declaration
bool Display3DShading { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to set Display3DShading
property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add option buttons
IOptionButtonShape optionButton1 = worksheet.OptionButtons.AddOptionButton();
IOptionButtonShape optionButton2 = worksheet.OptionButtons.AddOptionButton();
//Set text
optionButton1.Text = "Option1";
optionButton2.Text = "Option2";
//Set dimensions
optionButton1.Left = 60;
optionButton1.Top = 40;
optionButton1.Width = 100;
optionButton1.Height = 30;
optionButton2.Left = 160;
optionButton2.Top = 40;
optionButton2.Width = 100;
optionButton2.Height = 30;
//Set linked cell
optionButton1.LinkedCell = worksheet["$C$7"];
//Set state
optionButton1.CheckState = ExcelCheckState.Checked;
//Set 3D Shading
optionButton1.Display3DShading = true;
optionButton2.Display3DShading = true;
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
}
IsFirstButton
Indicates whether option button is first button. Read Only
Declaration
bool IsFirstButton { get; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to access IsFirstButton
property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add option buttons
IOptionButtonShape optionButton1 = worksheet.OptionButtons.AddOptionButton();
IOptionButtonShape optionButton2 = worksheet.OptionButtons.AddOptionButton();
//Set text
optionButton1.Text = "Option1";
optionButton2.Text = "Option2";
//Set dimensions
optionButton1.Left = 60;
optionButton1.Top = 40;
optionButton1.Width = 100;
optionButton1.Height = 30;
optionButton2.Left = 160;
optionButton2.Top = 40;
optionButton2.Width = 100;
optionButton2.Height = 30;
//Set linked cell
optionButton1.LinkedCell = worksheet["$C$7"];
//Set state
optionButton1.CheckState = ExcelCheckState.Checked;
//Check IsFirstButton
Console.WriteLine(optionButton1.IsFirstButton);
Console.WriteLine(optionButton2.IsFirstButton);
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//True
//False
LinkedCell
Indicates the cell in which the option button points to
Declaration
IRange LinkedCell { get; set; }
Property Value
Type |
---|
IRange |
Examples
The following code illustrates how to set LinkedCell
for IOptionButtonShape.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add option buttons
IOptionButtonShape optionButton1 = worksheet.OptionButtons.AddOptionButton();
IOptionButtonShape optionButton2 = worksheet.OptionButtons.AddOptionButton();
//Set text
optionButton1.Text = "Option1";
optionButton2.Text = "Option2";
//Set dimensions
optionButton1.Left = 60;
optionButton1.Top = 40;
optionButton1.Width = 100;
optionButton1.Height = 30;
optionButton2.Left = 160;
optionButton2.Top = 40;
optionButton2.Width = 100;
optionButton2.Height = 30;
//Set linked cell
optionButton1.LinkedCell = worksheet["$C$7"];
//Set state
optionButton1.CheckState = ExcelCheckState.Checked;
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
}