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

ComboBoxCellType

Class ComboBoxCellType

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

public class ComboBoxCellType extends BaseCellType
表示一个可编辑的组合框单元格。

组合框单元格类型显示一个下拉项目列表,用户可从中选择。项目通过 ComboBoxCellItem 对象添加。组合框可以配置为可编辑或只读,写入到数据模型的值可以通过 EditorValueType 控制。


 ComboBoxCellType cellType = new ComboBoxCellType();
 cellType.setEditorValueType(EditorValueType.Value);
 
 ComboBoxCellItem item = new ComboBoxCellItem();
 item.setValue("US");
 item.setText("United States");
 cellType.getItems().add(item);
 
 worksheet.getRange("C5").setCellType(cellType);
 worksheet.getRange("C5").setValue("US");
 
  • Constructor Details

    • ComboBoxCellType

      public ComboBoxCellType()
      创建一个组合框单元格类型。
  • Method Details

    • getItems

      public ArrayList<Object> getItems()
      获取组合框下拉列表中的项目。
      
       ComboBoxCellType cellType = new ComboBoxCellType();
       cellType.getItems().add("North");
       ArrayList<Object> items = cellType.getItems();
       
      Returns:
      组合框下拉列表中的项目。
    • getMaxDropDownItems

      public int getMaxDropDownItems()
      获取下拉列表每页的最大项目数。
      
       ComboBoxCellType cellType = new ComboBoxCellType();
       cellType.setMaxDropDownItems(5);
       int maxDropDownItems = cellType.getMaxDropDownItems();
       
      Returns:
      下拉列表每页的最大项目数。
    • setMaxDropDownItems

      public void setMaxDropDownItems(int value)
      设置下拉列表每页的最大项目数。
      
       ComboBoxCellType cellType = new ComboBoxCellType();
       cellType.setMaxDropDownItems(5);
       
      Parameters:
      value - 下拉列表每页显示的最大项目数。
    • getEditable

      public boolean getEditable()
      获取组合框是否可编辑。
      
       ComboBoxCellType cellType = new ComboBoxCellType();
       cellType.setEditable(true);
       boolean editable = cellType.getEditable();
       
      Returns:
      如果 Editable 为真,则为 true;否则为 false。
    • setEditable

      public void setEditable(boolean value)
      设置组合框是否可编辑。
      
       ComboBoxCellType cellType = new ComboBoxCellType();
       cellType.setEditable(true);
       
      Parameters:
      value - 组合框是否可编辑。
    • getEditorValueType

      public EditorValueType getEditorValueType()
      获取写入到底层数据模型的值。
      
       ComboBoxCellType cellType = new ComboBoxCellType();
       cellType.setEditorValueType(EditorValueType.Value);
       EditorValueType editorValueType = cellType.getEditorValueType();
       
      Returns:
      写入到底层数据模型的值。
    • setEditorValueType

      public void setEditorValueType(EditorValueType value)
      设置写入到底层数据模型的值。
      
       ComboBoxCellType cellType = new ComboBoxCellType();
       cellType.setEditorValueType(EditorValueType.Value);
       
      Parameters:
      value - 写入到底层数据模型的值类型。
    • getItemHeight

      public int getItemHeight()
      获取每个项目的高度。
      
       ComboBoxCellType cellType = new ComboBoxCellType();
       cellType.setItemHeight(24);
       int itemHeight = cellType.getItemHeight();
       
      Returns:
      每个项目的高度。
    • setItemHeight

      public void setItemHeight(int value)
      设置每个项目的高度。
      
       ComboBoxCellType cellType = new ComboBoxCellType();
       cellType.setItemHeight(24);
       
      Parameters:
      value - 每个项目的高度。