[]
        
(Showing Draft Content)

CheckBoxListCellType

Class CheckBoxListCellType

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

public class CheckBoxListCellType extends BaseCellType
Represents a checkbox list cell type.

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"}}});
 
  • Constructor Details

    • CheckBoxListCellType

      public CheckBoxListCellType()
      Create a check-box-list cell type.
  • Method Details

    • getItems

      public ArrayList<SelectFieldItem> getItems()
      Gets the items for the check-box-list list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.getItems().add(new SelectFieldItem("Option 1", "1"));
       ArrayList<SelectFieldItem> items = cellType.getItems();
       
      Returns:
      The list of check-box-list item.
    • getDirection

      public CellTypeDirection getDirection()
      Gets the direction of the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setDirection(CellTypeDirection.Vertical);
       CellTypeDirection direction = cellType.getDirection();
       
      Returns:
      The direction in which the check-box-list are arranged, such as horizontal or vertical.
    • setDirection

      public void setDirection(CellTypeDirection direction)
      Sets the direction of the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setDirection(CellTypeDirection.Vertical);
       
      Parameters:
      direction - The direction in which the check-box-list items are arranged.
    • getIsFlowLayout

      public boolean getIsFlowLayout()
      Gets the check-box-list's layout is autofit.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setIsFlowLayout(false);
       boolean isFlowLayout = cellType.getIsFlowLayout();
       
      Returns:
      True if the check-box-list's layout is autofit, false otherwise.
    • setIsFlowLayout

      public void setIsFlowLayout(boolean isFlowLayout)
      Sets the check-box-list's layout is autofit.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setIsFlowLayout(false);
       
      Parameters:
      isFlowLayout - True if the check-box-list's layout is autofit, false otherwise.
    • getTextAlign

      public CellTypeTextAlign getTextAlign()
      Gets the text of check-box-list's alignment, only support left and right.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setTextAlign(CellTypeTextAlign.Left);
       CellTypeTextAlign textAlign = cellType.getTextAlign();
       
      Returns:
      The text alignment of the check-box-list, such as left or right.
    • setTextAlign

      public void setTextAlign(CellTypeTextAlign textAlign)
      Sets the text of check-box-list's alignment, only support left and right.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setTextAlign(CellTypeTextAlign.Left);
       
      Parameters:
      textAlign - The text alignment of the check-box-list.
    • setMaxRowCount

      public void setMaxRowCount(int maxRowCount)
      Sets the maximum number of rows for the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setMaxRowCount(3);
       
      Parameters:
      maxRowCount - The maximum number of rows for the check-box-list.
    • getMaxRowCount

      public int getMaxRowCount()
      Gets the maximum number of rows for the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setMaxRowCount(3);
       int maxRowCount = cellType.getMaxRowCount();
       
      Returns:
      The maximum number of rows for the check-box-list.
    • setMaxColumnCount

      public void setMaxColumnCount(int maxColumnCount)
      Sets the maximum number of columns for the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setMaxColumnCount(2);
       
      Parameters:
      maxColumnCount - The maximum number of columns for the check-box-list.
    • getMaxColumnCount

      public int getMaxColumnCount()
      Gets the maximum number of columns for the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setMaxColumnCount(2);
       int maxColumnCount = cellType.getMaxColumnCount();
       
      Returns:
      The maximum number of columns for the check-box-list.
    • setHorizontalSpacing

      public void setHorizontalSpacing(int horizontalSpacing)
      Sets the horizontal spacing in the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setHorizontalSpacing(12);
       
      Parameters:
      horizontalSpacing - The horizontal spacing between check-box-list items.
    • getHorizontalSpacing

      public int getHorizontalSpacing()
      Gets the horizontal spacing in the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setHorizontalSpacing(12);
       int horizontalSpacing = cellType.getHorizontalSpacing();
       
      Returns:
      The horizontal spacing in the check-box-list.
    • setVerticalSpacing

      public void setVerticalSpacing(int verticalSpacing)
      Sets the vertical spacing in the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setVerticalSpacing(8);
       
      Parameters:
      verticalSpacing - The vertical spacing between check-box-list items.
    • getVerticalSpacing

      public int getVerticalSpacing()
      Gets the vertical spacing in the check-box-list.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setVerticalSpacing(8);
       int verticalSpacing = cellType.getVerticalSpacing();
       
      Returns:
      The vertical spacing in the check-box-list.
    • getBoxSize

      public int getBoxSize()
      Gets a value that indicates the check box size.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setBoxSize(16);
       int boxSize = cellType.getBoxSize();
       
      Returns:
      The size of the check box.
    • setBoxSize

      public void setBoxSize(int value)
      Sets a value that indicates the check box size.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setBoxSize(16);
       
      Parameters:
      value - The size of the check box.
    • getAutoBoxSize

      public boolean getAutoBoxSize()
      Gets whether boxSize changes with font size.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setAutoBoxSize(true);
       boolean autoBoxSize = cellType.getAutoBoxSize();
       
      Returns:
      True if the check box size changes with font size, false otherwise.
    • setAutoBoxSize

      public void setAutoBoxSize(boolean value)
      Sets whether boxSize changes with font size.
      
       CheckBoxListCellType cellType = new CheckBoxListCellType();
       cellType.setAutoBoxSize(true);
       
      Parameters:
      value - True if the check box size changes with font size, false otherwise.