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

CheckBoxListCellType

Class CheckBoxListCellType

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

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

复选框列表单元格类型允许用户在单个单元格内从复选框列表中选择多个项。可以配置列表的布局方向、文本对齐方式、间距以及行数和列数。使用 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"}}});
 
  • Constructor Details

    • CheckBoxListCellType

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

    • getItems

      public ArrayList<SelectFieldItem> getItems()
      获取复选框列表的项。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.getItems().add(new SelectFieldItem("Option 1", "1"));
       ArrayList<SelectFieldItem> items = cellType.getItems();
       
      Returns:
      复选框列表项的列表。
    • getDirection

      public CellTypeDirection getDirection()
      获取复选框列表的方向。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setDirection(CellTypeDirection.Vertical);
       CellTypeDirection direction = cellType.getDirection();
       
      Returns:
      复选框列表的排列方向,例如水平或垂直。
    • setDirection

      public void setDirection(CellTypeDirection direction)
      设置复选框列表的方向。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setDirection(CellTypeDirection.Vertical);
       
      Parameters:
      direction - 复选框列表项的排列方向。
    • getIsFlowLayout

      public boolean getIsFlowLayout()
      获取复选框列表的布局是否自适应。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setIsFlowLayout(false);
       boolean isFlowLayout = cellType.getIsFlowLayout();
       
      Returns:
      如果复选框列表的布局是自适应的,则为 true;否则为 false。
    • setIsFlowLayout

      public void setIsFlowLayout(boolean isFlowLayout)
      设置复选框列表的布局是否自适应。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setIsFlowLayout(false);
       
      Parameters:
      isFlowLayout - 如果复选框列表的布局是自适应的,则为 true;否则为 false。
    • getTextAlign

      public CellTypeTextAlign getTextAlign()
      获取复选框列表的文本对齐方式,仅支持左侧和右侧。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setTextAlign(CellTypeTextAlign.Left);
       CellTypeTextAlign textAlign = cellType.getTextAlign();
       
      Returns:
      复选框列表的文本对齐方式,例如左侧或右侧。
    • setTextAlign

      public void setTextAlign(CellTypeTextAlign textAlign)
      设置复选框列表的文本对齐方式,仅支持左侧和右侧。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setTextAlign(CellTypeTextAlign.Left);
       
      Parameters:
      textAlign - 复选框列表的文本对齐方式。
    • setMaxRowCount

      public void setMaxRowCount(int maxRowCount)
      设置复选框列表的最大行数。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setMaxRowCount(3);
       
      Parameters:
      maxRowCount - 复选框列表的最大行数。
    • getMaxRowCount

      public int getMaxRowCount()
      获取复选框列表的最大行数。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setMaxRowCount(3);
       int maxRowCount = cellType.getMaxRowCount();
       
      Returns:
      复选框列表的最大行数。
    • setMaxColumnCount

      public void setMaxColumnCount(int maxColumnCount)
      设置复选框列表的最大列数。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setMaxColumnCount(2);
       
      Parameters:
      maxColumnCount - 复选框列表的最大列数。
    • getMaxColumnCount

      public int getMaxColumnCount()
      获取复选框列表的最大列数。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setMaxColumnCount(2);
       int maxColumnCount = cellType.getMaxColumnCount();
       
      Returns:
      复选框列表的最大列数。
    • setHorizontalSpacing

      public void setHorizontalSpacing(int horizontalSpacing)
      设置复选框列表中的水平间距。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setHorizontalSpacing(12);
       
      Parameters:
      horizontalSpacing - 复选框列表项之间的水平间距。
    • getHorizontalSpacing

      public int getHorizontalSpacing()
      获取复选框列表中的水平间距。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setHorizontalSpacing(12);
       int horizontalSpacing = cellType.getHorizontalSpacing();
       
      Returns:
      复选框列表中的水平间距。
    • setVerticalSpacing

      public void setVerticalSpacing(int verticalSpacing)
      设置复选框列表中的垂直间距。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setVerticalSpacing(8);
       
      Parameters:
      verticalSpacing - 复选框列表项之间的垂直间距。
    • getVerticalSpacing

      public int getVerticalSpacing()
      获取复选框列表中的垂直间距。
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setVerticalSpacing(8);
       int verticalSpacing = cellType.getVerticalSpacing();
       
      Returns:
      复选框列表中的垂直间距。
    • getBoxSize

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

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

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

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