[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
立即试用
(Showing Draft Content)

CheckBoxCellType

Class CheckBoxCellType

java.lang.Object
com.grapecity.documents.excel.BaseCellType
com.grapecity.documents.excel.CheckBoxCellType

public class CheckBoxCellType extends BaseCellType
表示复选框单元格类型。

复选框单元格类型在单元格中显示复选框控件。它支持可配置的标题文本、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);
 
  • Constructor Details

    • CheckBoxCellType

      public CheckBoxCellType()
      创建一个复选框单元格类型。
  • Method Details

    • getCaption

      public String getCaption()
      获取单元格类型的标题。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setCaption("Approve");
       String caption = cellType.getCaption();
       
      Returns:
      复选框的标题。
    • setCaption

      public void setCaption(String value)
      设置单元格类型的标题。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setCaption("Approve");
       
      Parameters:
      value - 复选框的标题。
    • getTextTrue

      public String getTextTrue()
      获取当单元格的值为 true 时单元格中的文本。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setTextTrue("Checked");
       String trueText = cellType.getTextTrue();
       
      Returns:
      true 值的文本。
    • setTextTrue

      public void setTextTrue(String value)
      设置当单元格的值为 true 时单元格中的文本。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setTextTrue("Checked");
       
      Parameters:
      value - true 值的文本。
    • getTextFalse

      public String getTextFalse()
      获取当单元格的值为 false 时单元格中的文本。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setTextFalse("Unchecked");
       String falseText = cellType.getTextFalse();
       
      Returns:
      表示 false 值的文本。
    • setTextFalse

      public void setTextFalse(String value)
      设置当单元格的值为 false 时单元格中的文本。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setTextFalse("Unchecked");
       
      Parameters:
      value - false 值的文本。
    • getTextIndeterminate

      public String getTextIndeterminate()
      获取当单元格的值为不确定(既不是true也不是false)时单元格中的文本。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setTextIndeterminate("Pending");
       String indeterminateText = cellType.getTextIndeterminate();
       
      Returns:
      不确定值的文本。
    • setTextIndeterminate

      public void setTextIndeterminate(String value)
      设置当单元格的值为不确定(既不是true也不是false)时单元格中的文本。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setTextIndeterminate("Pending");
       
      Parameters:
      value - 不确定值的文本。
    • getTextAlign

      public CheckBoxAlign getTextAlign()
      获取相对于复选框的文本对齐方式。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setTextAlign(CheckBoxAlign.Right);
       CheckBoxAlign textAlign = cellType.getTextAlign();
       
      Returns:
      相对于复选框的文本对齐方式。
    • setTextAlign

      public void setTextAlign(CheckBoxAlign value)
      设置相对于复选框的文本对齐方式。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setTextAlign(CheckBoxAlign.Right);
       
      Parameters:
      value - 相对于复选框的文本对齐方式。
    • getIsThreeState

      public boolean getIsThreeState()
      获取一个指示复选框是否支持三种状态的值。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setIsThreeState(true);
       boolean isThreeState = cellType.getIsThreeState();
       
      Returns:
      如果复选框支持三种状态,则为 true;否则为 false。
    • setIsThreeState

      public void setIsThreeState(boolean value)
      设置一个值,该值指示复选框是否支持三种状态。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setIsThreeState(true);
       
      Parameters:
      value - 如果复选框支持三种状态,则为 true;否则为 false。
    • getBoxSize

      public int getBoxSize()
      获取指示复选框大小的值。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setBoxSize(16);
       int boxSize = cellType.getBoxSize();
       
      Returns:
      复选框的大小。
    • setBoxSize

      public void setBoxSize(int value)
      设置指示复选框大小的值。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setBoxSize(16);
       
      Parameters:
      value - 复选框的大小。
    • getAutoBoxSize

      public boolean getAutoBoxSize()
      获取复选框大小是否随字体大小变化。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setAutoBoxSize(true);
       boolean autoBoxSize = cellType.getAutoBoxSize();
       
      Returns:
      如果复选框大小随字体大小变化,则为 true;否则为 false。
    • setAutoBoxSize

      public void setAutoBoxSize(boolean value)
      设置复选框大小是否随字体大小变化。
      
       CheckBoxCellType cellType = new CheckBoxCellType();
       cellType.setAutoBoxSize(true);
       
      Parameters:
      value - 如果复选框大小随字体大小变化,则为 true;否则为 false。