[]
复选框列表单元格类型允许用户在单个单元格内从复选框列表中选择多个项。可以配置列表的布局方向、文本对齐方式、间距以及行数和列数。使用 SelectFieldItem 定义列表中的项。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setDirection(CellTypeDirection.Horizontal);
cellType.setTextAlign(CellTypeTextAlign.Right);
cellType.setMaxColumnCount(2);
cellType.getItems().add(new SelectFieldItem("sample1", "1"));
cellType.getItems().add(new SelectFieldItem("sample2", "2"));
cellType.getItems().add(new SelectFieldItem("sample3", "3"));
worksheet.getRange("A1").setCellType(cellType);
worksheet.getRange("A1").setValue(new Object[][]{{new Object[]{"1", "3"}}});
booleanintintbooleangetItems()intintintvoidsetAutoBoxSize(boolean value) voidsetBoxSize(int value) voidsetDirection(CellTypeDirection direction) voidsetHorizontalSpacing(int horizontalSpacing) voidsetIsFlowLayout(boolean isFlowLayout) voidsetMaxColumnCount(int maxColumnCount) voidsetMaxRowCount(int maxRowCount) voidsetTextAlign(CellTypeTextAlign textAlign) voidsetVerticalSpacing(int verticalSpacing)
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.getItems().add(new SelectFieldItem("Option 1", "1"));
ArrayList<SelectFieldItem> items = cellType.getItems();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setDirection(CellTypeDirection.Vertical);
CellTypeDirection direction = cellType.getDirection();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setDirection(CellTypeDirection.Vertical);
direction - 复选框列表项的排列方向。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setIsFlowLayout(false);
boolean isFlowLayout = cellType.getIsFlowLayout();
true;否则为 false。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setIsFlowLayout(false);
isFlowLayout - 如果复选框列表的布局是自适应的,则为 true;否则为 false。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setTextAlign(CellTypeTextAlign.Left);
CellTypeTextAlign textAlign = cellType.getTextAlign();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setTextAlign(CellTypeTextAlign.Left);
textAlign - 复选框列表的文本对齐方式。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setMaxRowCount(3);
maxRowCount - 复选框列表的最大行数。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setMaxRowCount(3);
int maxRowCount = cellType.getMaxRowCount();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setMaxColumnCount(2);
maxColumnCount - 复选框列表的最大列数。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setMaxColumnCount(2);
int maxColumnCount = cellType.getMaxColumnCount();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setHorizontalSpacing(12);
horizontalSpacing - 复选框列表项之间的水平间距。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setHorizontalSpacing(12);
int horizontalSpacing = cellType.getHorizontalSpacing();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setVerticalSpacing(8);
verticalSpacing - 复选框列表项之间的垂直间距。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setVerticalSpacing(8);
int verticalSpacing = cellType.getVerticalSpacing();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setBoxSize(16);
int boxSize = cellType.getBoxSize();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setBoxSize(16);
value - 复选框的大小。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setAutoBoxSize(true);
boolean autoBoxSize = cellType.getAutoBoxSize();
true;否则为 false。
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setAutoBoxSize(true);
value - 如果复选框大小随字体大小变化,则为 true;否则为 false。