[]
组合框单元格类型显示一个下拉项目列表,用户可从中选择。项目通过 ComboBoxCellItem 对象添加。组合框可以配置为可编辑或只读,写入到数据模型的值可以通过 EditorValueType 控制。
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.setEditorValueType(EditorValueType.Value);
ComboBoxCellItem item = new ComboBoxCellItem();
item.setValue("US");
item.setText("United States");
cellType.getItems().add(item);
worksheet.getRange("C5").setCellType(cellType);
worksheet.getRange("C5").setValue("US");
booleanintgetItems()intvoidsetEditable(boolean value) voidvoidsetItemHeight(int value) voidsetMaxDropDownItems(int value)
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.getItems().add("North");
ArrayList<Object> items = cellType.getItems();
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.setMaxDropDownItems(5);
int maxDropDownItems = cellType.getMaxDropDownItems();
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.setMaxDropDownItems(5);
value - 下拉列表每页显示的最大项目数。
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.setEditable(true);
boolean editable = cellType.getEditable();
true;否则为 false。
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.setEditable(true);
value - 组合框是否可编辑。
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.setEditorValueType(EditorValueType.Value);
EditorValueType editorValueType = cellType.getEditorValueType();
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.setEditorValueType(EditorValueType.Value);
value - 写入到底层数据模型的值类型。
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.setItemHeight(24);
int itemHeight = cellType.getItemHeight();
ComboBoxCellType cellType = new ComboBoxCellType();
cellType.setItemHeight(24);
value - 每个项目的高度。