Aspose Excel Combobox inside cell

Hello,

I’m adding dynamic dropdown (combobox) in specific cell of excel. But newly generated dropdown doesn’t fit inside assigned cell.

Please find my code :

ComboBox cb = null;
cb = worksheets.Shapes.AddComboBox(5, 0, 5, 0, 20, 160);
cb.InputRange = “Sheet1!A1:A2”;
cb.DropDownLines = 100;

Also find attached image for same.dropdown indside cell.png (9.3 KB)

@sdtechsupport.sirius

Please try the following code and see the screenshot of output Excel file generated by it for your reference.

Please add some values in range A1:A5 so that drop down could show some data. It should fix your issue.

C#

Workbook wb = new Workbook();

Worksheet worksheet = wb.Worksheets[0];

worksheet.Cells["A1"].PutValue("Apple");
worksheet.Cells["A2"].PutValue("Pear");
worksheet.Cells["A3"].PutValue("Pen");
worksheet.Cells["A4"].PutValue("USA");
worksheet.Cells["A5"].PutValue("China");

ComboBox cb = worksheet.Shapes.AddComboBox(5, 0, 5, 0, 20, 160);
cb.InputRange = "Sheet1!A1:A5";
cb.DropDownLines = 100;

wb.Save("out.xlsx");

Download Link:
Output Excel File.zip (6.5 KB)

Screenshot