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

ComboBoxCellItem

Class ComboBoxCellItem

java.lang.Object
com.grapecity.documents.excel.ComboBoxCellItem

public class ComboBoxCellItem extends Object
表示一个组合框项。

每个项都有 value 和 text。文本显示在组合框下拉列表中,而值存储在底层数据模型中。项添加到 ComboBoxCellType 时通过 ComboBoxCellType.getItems()。


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

    • ComboBoxCellItem

      public ComboBoxCellItem()
  • Method Details

    • getValue

      public Object getValue()
      获取项的值。
      
       ComboBoxCellItem item = new ComboBoxCellItem();
       item.setValue("US");
       Object value = item.getValue();
       
      Returns:
      项的值。
    • setValue

      public void setValue(Object value)
      设置项目的值。
      
       ComboBoxCellItem item = new ComboBoxCellItem();
       item.setValue("US");
       
      Parameters:
      value - 项目的值。
    • getText

      public String getText()
      获取项的文本。
      
       ComboBoxCellItem item = new ComboBoxCellItem();
       item.setText("United States");
       String text = item.getText();
       
      Returns:
      项的文本。
    • setText

      public void setText(String text)
      设置项的文本。
      
       ComboBoxCellItem item = new ComboBoxCellItem();
       item.setText("United States");
       
      Parameters:
      text - 项的文本。