[]
复选框单元格类型在单元格中显示复选框控件。它支持可配置的标题文本、true/false/不确定状态的文本标签、相对于复选框的文本对齐方式以及可选的三态模式。通过 IRange.setCellType(BaseCellType) 可将其分配给单元格或区域。单元格类型会保留在 SpreadJS JSON I/O 中,但在 Excel 文件格式 (.xlsx) 中不受支持。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setCaption("Caption");
cellType.setTextTrue("True");
cellType.setTextFalse("False");
cellType.setIsThreeState(true);
cellType.setTextAlign(CheckBoxAlign.Right);
worksheet.getRange("A1:A2").setCellType(cellType);
worksheet.getRange("A1").setValue(true);
worksheet.getRange("A2").setValue(false);
booleanintbooleanfalse 时单元格中的文本。true 时单元格中的文本。voidsetAutoBoxSize(boolean value) voidsetBoxSize(int value) voidsetCaption(String value) voidsetIsThreeState(boolean value) voidsetTextAlign(CheckBoxAlign value) voidsetTextFalse(String value) false 时单元格中的文本。voidsetTextIndeterminate(String value) voidsetTextTrue(String value) true 时单元格中的文本。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setCaption("Approve");
String caption = cellType.getCaption();
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setCaption("Approve");
value - 复选框的标题。true 时单元格中的文本。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setTextTrue("Checked");
String trueText = cellType.getTextTrue();
true 值的文本。true 时单元格中的文本。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setTextTrue("Checked");
value - true 值的文本。false 时单元格中的文本。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setTextFalse("Unchecked");
String falseText = cellType.getTextFalse();
false 值的文本。false 时单元格中的文本。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setTextFalse("Unchecked");
value - false 值的文本。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setTextIndeterminate("Pending");
String indeterminateText = cellType.getTextIndeterminate();
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setTextIndeterminate("Pending");
value - 不确定值的文本。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setTextAlign(CheckBoxAlign.Right);
CheckBoxAlign textAlign = cellType.getTextAlign();
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setTextAlign(CheckBoxAlign.Right);
value - 相对于复选框的文本对齐方式。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setIsThreeState(true);
boolean isThreeState = cellType.getIsThreeState();
true;否则为 false。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setIsThreeState(true);
value - 如果复选框支持三种状态,则为 true;否则为 false。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setBoxSize(16);
int boxSize = cellType.getBoxSize();
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setBoxSize(16);
value - 复选框的大小。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setAutoBoxSize(true);
boolean autoBoxSize = cellType.getAutoBoxSize();
true;否则为 false。
CheckBoxCellType cellType = new CheckBoxCellType();
cellType.setAutoBoxSize(true);
value - 如果复选框大小随字体大小变化,则为 true;否则为 false。