[]
ICellLinkControl, ICellLinkControlT<Integer>, IControl, IControlT<IListBox>, ISelector, ISelectorT<ListBoxItem,IListBoxItemList> A list box displays a collection of ListBoxItem objects and lets users select one or more items, depending on the configured SelectionMode. Use IControlCollection.addListBox(double,double,double,double) to add a list box to a worksheet, then populate it through ISelectorT.getItems() and configure its selection behavior with setSelectionMode(SelectionMode).
IListBox listBox = worksheet.getControls().addListBox(50, 100, 120, 80);
listBox.getItems().add(new ListBoxItem("Apple"));
listBox.getItems().add(new ListBoxItem("Orange"));
listBox.setSelectionMode(SelectionMode.Extended);
IListBoxItemCollection selectedItems = listBox.getSelectedItems();
voidsetSelectionMode(SelectionMode value) getDisplay3DShading, getLinkedCell, setDisplay3DShading, setLinkedCellgetValue, setValuebringToFront, delete, getBottomRightCell, getEnabled, getFormControlType, getHeight, getLeft, getLocked, getName, getParent, getPlacement, getPrintObject, getShapeRange, getTop, getTopLeftCell, getVisible, getWidth, getZOrder, sendToBack, setEnabled, setHeight, setLeft, setLocked, setName, setPlacement, setPrintObject, setTop, setVisible, setWidthgetItemsSourceRange, getSelectedIndex, setItemsSourceRange, setSelectedIndexgetItems, getSelectedItemReturns the current SelectionMode that controls whether the list box allows single selection or multiple selection.
IListBox listBox = worksheet.getControls().addListBox(50, 100, 120, 80);
listBox.getItems().add(new ListBoxItem("Apple"));
listBox.setSelectionMode(SelectionMode.Extended);
SelectionMode mode = listBox.getSelectionMode();
Use this method to control whether the list box allows single selection, multiple selection, or extended multiple selection through SelectionMode. Changing between single-selection and multi-selection modes resets the current selection state as needed to match the new mode.
IListBox listBox = worksheet.getControls().addListBox(50, 100, 120, 80);
listBox.getItems().add(new ListBoxItem("Apple"));
listBox.getItems().add(new ListBoxItem("Orange"));
listBox.setSelectionMode(SelectionMode.Extended);
IListBoxItemCollection selectedItems = listBox.getSelectedItems();
value - The selection mode to apply.Returns the collection that represents the current selection in the list box. When the selection mode allows multiple selection, the collection can contain more than one item.
IListBox listBox = worksheet.getControls().addListBox(20, 20, 120, 60);
listBox.getItems().add(new ListBoxItem("North"));
listBox.getItems().add(new ListBoxItem("South"));
listBox.setSelectionMode(SelectionMode.Extended);
listBox.getSelectedItems().add(listBox.getItems().get(0));
IListBoxItemCollection selectedItems = listBox.getSelectedItems();