alexa
menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Interface IComboBoxes

    This interface represents collection of all combo box inside single worksheet.

    Namespace: Syncfusion.XlsIO
    Assembly: Syncfusion.XlsIO.NET.dll
    Syntax
    public interface IComboBoxes

    Properties

    Count

    Returns number of IComboBoxShape in the IComboBoxes collection.

    Declaration
    int Count { get; }
    Property Value
    Type
    int
    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

    this[int]

    Returns single IComboBoxShape from the IComboBoxes collection.

    Declaration
    IComboBoxShape this[int index] { get; }
    Parameters
    Type Name Description
    int 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();
    }

    this[string]

    Gets single item from the collection.

    Declaration
    IComboBoxShape this[string name] { get; }
    Parameters
    Type Name Description
    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(int, int, int, int)

    Adds new IComboBoxShape to the IComboBoxes collection.

    Declaration
    IComboBoxShape AddComboBox(int row, int column, int height, int width)
    Parameters
    Type Name Description
    int row

    One-based row index of the top-left corner of the new item.

    int column

    One-based column index of the top-left corner of the new item.

    int height

    Height in pixels of the new item.

    int 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();
    }
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved