[]
A checkbox list cell type allows users to select multiple items from a list of checkboxes within a single cell. You can configure the layout direction, text alignment, spacing, and the number of rows and columns for the list. Use SelectFieldItem to define the items in the list.
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 - The direction in which the check-box-list items are arranged.
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setIsFlowLayout(false);
boolean isFlowLayout = cellType.getIsFlowLayout();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setIsFlowLayout(false);
isFlowLayout - True if the check-box-list's layout is autofit, false otherwise.
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setTextAlign(CellTypeTextAlign.Left);
CellTypeTextAlign textAlign = cellType.getTextAlign();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setTextAlign(CellTypeTextAlign.Left);
textAlign - The text alignment of the check-box-list.
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setMaxRowCount(3);
maxRowCount - The maximum number of rows for the check-box-list.
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setMaxRowCount(3);
int maxRowCount = cellType.getMaxRowCount();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setMaxColumnCount(2);
maxColumnCount - The maximum number of columns for the check-box-list.
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setMaxColumnCount(2);
int maxColumnCount = cellType.getMaxColumnCount();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setHorizontalSpacing(12);
horizontalSpacing - The horizontal spacing between check-box-list items.
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setHorizontalSpacing(12);
int horizontalSpacing = cellType.getHorizontalSpacing();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setVerticalSpacing(8);
verticalSpacing - The vertical spacing between check-box-list items.
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 - The size of the check box.
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setAutoBoxSize(true);
boolean autoBoxSize = cellType.getAutoBoxSize();
CheckBoxListCellType cellType = new CheckBoxListCellType();
cellType.setAutoBoxSize(true);
value - True if the check box size changes with font size, false otherwise.