// Create a new workbook Workbook workbook = new Workbook(); IWorksheet ws = workbook.getWorksheets().get("Sheet1"); ws.getRange("A:A").setColumnWidthInPixel(25d); // Add items (unbound mode) ws.getRange("B2").setValue("Drop downs support unbound mode. You can add items with code."); IDropDown dropBox1 = ws.getControls().addDropDown(21.55, 38.4, 276.4, 30.19); dropBox1.getItems().add(new DropDownItem("Unbound Item 1")); dropBox1.getItems().add(new DropDownItem("Unbound Item 2")); dropBox1.getItems().add(new DropDownItem("Unbound Item 3")); dropBox1.setSelectedIndex(0); // Specify a items source range ws.getRange("B7").setValue("You can also use data binding to set the item source and bind selected index."); ws.getRange("B12:B15").setValue(new Object[][] { { "Items"}, { "Item 1"}, { "Item 2"}, { "Item 3"} }); ws.getRange("D12:D13").setValue(new Object[][] { { "Value"}, { 1d} }); IDropDown dropBox2 = ws.getControls().addDropDown(20.95, 123.8, 279.90, 26.50); dropBox2.setItemsSourceRange(ws.getRange("B13:B15")); dropBox2.setLinkedCell(ws.getRange("D13")); dropBox2.setSelectedIndex(0); // Save to an excel file workbook.save("DropDownsBasicUsage.xlsx");