Interface IComboBoxes
This interface represents collection of all combo box inside single worksheet.
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.UWP.dll
Syntax
public interface IComboBoxes
Properties
Count
Returns number of IComboBoxShape in the IComboBoxes 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
IComboBoxShape combobox1 = worksheet.ComboBoxes.AddComboBox(1, 1, 20, 100);
IComboBoxShape combobox2 = worksheet.ComboBoxes.AddComboBox(5, 5, 20, 100);
//Get count
Console.Write(worksheet.ComboBoxes.Count);
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//2
Item[Int32]
Returns single IComboBoxShape from the IComboBoxes collection.
Declaration
IComboBoxShape this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Item's index to get. |
Property Value
Type | Description |
---|---|
IComboBoxShape | Single item from the collection. |
Examples
The following code illustrates how to access a IComboBoxShape from the IComboBoxes 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.ComboBoxes.AddComboBox(1, 1, 20, 100);
worksheet.ComboBoxes.AddComboBox(5, 5, 20, 100);
//Set name
worksheet.ComboBoxes[0].Name = "ComboBox1";
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
}
Item[String]
Gets single item from the collection.
Declaration
IComboBoxShape this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the item to get. |
Property Value
Type | Description |
---|---|
IComboBoxShape | Single item from the collection. |
Examples
The following code illustrates how to access a IComboBoxShape from the IComboBoxes 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.ComboBoxes.AddComboBox(1, 1, 20, 100);
//Set name
worksheet.ComboBoxes[0].Name = "ComboBox1";
//Get width
Console.Write(worksheet.ComboBoxes["ComboBox1"].Width);
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//100
Methods
AddComboBox(Int32, Int32, Int32, Int32)
Adds new IComboBoxShape to the IComboBoxes collection.
Declaration
IComboBoxShape AddComboBox(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 |
---|---|
IComboBoxShape | Newly added item. |
Examples
The following code illustrates how to add a IComboBoxShape to the IComboBoxes 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
IComboBoxShape combobox = worksheet.ComboBoxes.AddComboBox(1, 1, 20, 100);
//Save and dispose
workbook.SaveAs("Shapes.xlsx");
workbook.Close();
}