Interface ICheckBoxShape
This interface represents TextBox form control shape.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public interface ICheckBoxShape : ITextBoxShape, ITextBox, IShape, IParentApplication
Properties
CheckState
Indicates whether check box is checked.
Declaration
ExcelCheckState CheckState { get; set; }
Property Value
Type |
---|
ExcelCheckState |
Examples
By default, Unchecked is set to CheckState
property. Here for example, we
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 shape
ICheckBoxShape checkbox = worksheet.Shapes.AddCheckBox();
//Set checkbox state
checkbox.CheckState = ExcelCheckState.Checked;
//Set text
checkbox.Text = "Checkbox select";
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
}
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 the checkbox.
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 shape
ICheckBoxShape checkbox = worksheet.Shapes.AddCheckBox();
//Set linked cell
checkbox.LinkedCell = worksheet["C7"];
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
}