Interface ICheckBoxes
This interface represents CheckBoxes collection inside single worksheet.
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Portable.dll
Syntax
public interface ICheckBoxes
Properties
Count
Returns number of ICheckBoxShape objects in the ICheckBoxes collection.
Declaration
int Count { get; }
Property Value
Type |
---|
System.Int32 |
Examples
The following code illustrates how to access Count
property.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add combobox
worksheet.CheckBoxes.AddCheckBox(1, 1, 20, 100);
worksheet.CheckBoxes.AddCheckBox(5, 5, 20, 100);
//Check count
Console.Write(worksheet.CheckBoxes.Count);
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//2
Item[Int32]
Returns single ICheckBoxShape from the ICheckBoxes collection.
Declaration
ICheckBoxShape this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Item's index to get. |
Property Value
Type | Description |
---|---|
ICheckBoxShape | Single item from the collection. |
Examples
The following code illustrates how to access a ICheckBoxShape from the ICheckBoxes collection.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add combobox
worksheet.CheckBoxes.AddCheckBox(1, 1, 20, 100);
worksheet.CheckBoxes.AddCheckBox(5, 5, 20, 100);
//Set name
worksheet.CheckBoxes[0].Name = "CheckBox1";
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
}
Item[String]
Gets single ICheckBoxShape from the ICheckBoxes collection.
Declaration
ICheckBoxShape this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the item to get. |
Property Value
Type | Description |
---|---|
ICheckBoxShape | Single item from the collection. |
Examples
The following code illustrates how to access a ICheckBoxShape from the ICheckBoxes collection.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add combobox
worksheet.CheckBoxes.AddCheckBox(1, 1, 20, 100);
//Set name
worksheet.CheckBoxes[0].Name = "CheckBox1";
//Get width
Console.Write(worksheet.CheckBoxes["CheckBox1"].Width);
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//100
Methods
AddCheckBox(Int32, Int32, Int32, Int32)
Adds new ICheckBoxShape to the ICheckBoxes collection.
Declaration
ICheckBoxShape AddCheckBox(int row, int column, int height, int width)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | One-based row index of the top-left corner of the new item. |
System.Int32 | column | One-based column index of the top-left corner of the new item. |
System.Int32 | height | Height in pixels of the new item. |
System.Int32 | width | Width in pixels of the new item. |
Returns
Type | Description |
---|---|
ICheckBoxShape | Newly added item. |
Examples
The following code illustrates how to Add a ICheckBoxShape object to the ICheckBoxes collection.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Add combobox
ICheckBoxShape checkbox = worksheet.CheckBoxes.AddCheckBox(1, 1, 20, 100);
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
}