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

ButtonCellType

Class ButtonCellType

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

public class ButtonCellType extends BaseCellType
表示按钮单元格类型。

用于在单元格中显示按钮。支持自定义按钮文本、背景色以及相对于单元格边缘的边距。可以通过 IRange.setCellType(BaseCellType) 或IWorksheet.setCellType(BaseCellType) 应用于单个单元格、区域、行、列或整个工作表。


 ButtonCellType button = new ButtonCellType();
 button.setText("Click Me");
 button.setButtonBackColor("Azure");
 button.setMarginLeft(10);
 button.setMarginRight(10);
 worksheet.getRange("A1").setCellType(button);
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    初始化 ButtonCellType 类的新实例。
  • Method Summary

    Modifier and Type
    Method
    Description
    获取按钮的背景颜色。
    double
    获取按钮相对于单元格的底边距(以像素为单位)。
    double
    获取按钮相对于单元格的左边距(以像素为单位)。
    double
    获取按钮相对于单元格的右边距(以像素为单位)。
    double
    获取按钮相对于单元格的上边距(以像素为单位)。
    获取按钮的内容。
    void
    设置按钮的背景颜色。
    void
    setMarginBottom(double value)
    设置按钮相对于单元格的底边距(以像素为单位)。
    void
    setMarginLeft(double value)
    设置按钮相对于单元格的左边距(以像素为单位)。
    void
    setMarginRight(double value)
    设置按钮相对于单元格的右边距(以像素为单位)。
    void
    setMarginTop(double value)
    设置按钮相对于单元格的顶部边距(以像素为单位)。
    void
    setText(String value)
    设置按钮的内容。

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ButtonCellType

      public ButtonCellType()
      初始化 ButtonCellType 类的新实例。
  • Method Details

    • getText

      public String getText()
      获取按钮的内容。
      
       ButtonCellType button = new ButtonCellType();
       button.setText("Submit");
       String text = button.getText();
       
      Returns:
      按钮的文本内容。
    • setText

      public void setText(String value)
      设置按钮的内容。
      
       ButtonCellType button = new ButtonCellType();
       button.setText("Submit");
       
      Parameters:
      value - 按钮的文本内容。
    • getButtonBackColor

      public String getButtonBackColor()
      获取按钮的背景颜色。
      
       ButtonCellType button = new ButtonCellType();
       button.setButtonBackColor("Azure");
       String color = button.getButtonBackColor();
       
      Returns:
      按钮的背景颜色。
    • setButtonBackColor

      public void setButtonBackColor(String value)
      设置按钮的背景颜色。
      
       ButtonCellType button = new ButtonCellType();
       button.setButtonBackColor("Azure");
       
      Parameters:
      value - 按钮的背景颜色。
    • getMarginLeft

      public double getMarginLeft()
      获取按钮相对于单元格的左边距(以像素为单位)。
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginLeft(6);
       double marginLeft = button.getMarginLeft();
       
      Returns:
      按钮的左边距(以像素为单位)。
    • setMarginLeft

      public void setMarginLeft(double value)
      设置按钮相对于单元格的左边距(以像素为单位)。
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginLeft(6);
       
      Parameters:
      value - 按钮的左边距(以像素为单位)。
    • getMarginRight

      public double getMarginRight()
      获取按钮相对于单元格的右边距(以像素为单位)。
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginRight(6);
       double marginRight = button.getMarginRight();
       
      Returns:
      按钮的右边距(以像素为单位)。
    • setMarginRight

      public void setMarginRight(double value)
      设置按钮相对于单元格的右边距(以像素为单位)。
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginRight(6);
       
      Parameters:
      value - 按钮的右边距(以像素为单位)。
    • getMarginTop

      public double getMarginTop()
      获取按钮相对于单元格的上边距(以像素为单位)。
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginTop(6);
       double marginTop = button.getMarginTop();
       
      Returns:
      按钮的上边距(以像素为单位)。
    • setMarginTop

      public void setMarginTop(double value)
      设置按钮相对于单元格的顶部边距(以像素为单位)。
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginTop(6);
       
      Parameters:
      value - 按钮的顶部边距,以像素为单位。
    • getMarginBottom

      public double getMarginBottom()
      获取按钮相对于单元格的底边距(以像素为单位)。
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginBottom(6);
       double marginBottom = button.getMarginBottom();
       
      Returns:
      按钮的底边距(以像素为单位)。
    • setMarginBottom

      public void setMarginBottom(double value)
      设置按钮相对于单元格的底边距(以像素为单位)。
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginBottom(6);
       
      Parameters:
      value - 按钮的底边距(以像素为单位)。