[]
        
(Showing Draft Content)

ButtonCellType

Class ButtonCellType

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

public class ButtonCellType extends BaseCellType
Represents a button cell type.

Used to display a button in a cell. Supports customizing the button text, background color, and margins relative to the cell edges. Can be applied to a single cell, a range, a row, a column, or an entire worksheet via IRange.setCellType(BaseCellType) or 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 Details

    • ButtonCellType

      public ButtonCellType()
      Initializes a new instance of the ButtonCellType class.
  • Method Details

    • getText

      public String getText()
      Gets the button's content.
      
       ButtonCellType button = new ButtonCellType();
       button.setText("Submit");
       String text = button.getText();
       
      Returns:
      The text content of the button.
    • setText

      public void setText(String value)
      Sets the button's content.
      
       ButtonCellType button = new ButtonCellType();
       button.setText("Submit");
       
      Parameters:
      value - The text content of the button.
    • getButtonBackColor

      public String getButtonBackColor()
      Gets the button's background color.
      
       ButtonCellType button = new ButtonCellType();
       button.setButtonBackColor("Azure");
       String color = button.getButtonBackColor();
       
      Returns:
      The background color of the button.
    • setButtonBackColor

      public void setButtonBackColor(String value)
      Sets the button's background color.
      
       ButtonCellType button = new ButtonCellType();
       button.setButtonBackColor("Azure");
       
      Parameters:
      value - The background color of the button.
    • getMarginLeft

      public double getMarginLeft()
      Gets the button's left margin in pixels relative to the cell.
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginLeft(6);
       double marginLeft = button.getMarginLeft();
       
      Returns:
      The left margin of the button in pixels.
    • setMarginLeft

      public void setMarginLeft(double value)
      Sets the button's left margin in pixels relative to the cell.
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginLeft(6);
       
      Parameters:
      value - The left margin of the button in pixels.
    • getMarginRight

      public double getMarginRight()
      Gets the button's right margin in pixels relative to the cell.
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginRight(6);
       double marginRight = button.getMarginRight();
       
      Returns:
      The right margin of the button in pixels.
    • setMarginRight

      public void setMarginRight(double value)
      Sets the button's right margin in pixels relative to the cell.
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginRight(6);
       
      Parameters:
      value - The right margin of the button in pixels.
    • getMarginTop

      public double getMarginTop()
      Gets the button's top margin in pixels relative to the cell.
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginTop(6);
       double marginTop = button.getMarginTop();
       
      Returns:
      The top margin of the button in pixels.
    • setMarginTop

      public void setMarginTop(double value)
      Sets the button's top margin in pixels relative to the cell.
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginTop(6);
       
      Parameters:
      value - The top margin of the button in pixels.
    • getMarginBottom

      public double getMarginBottom()
      Gets the button's bottom margin in pixels relative to the cell.
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginBottom(6);
       double marginBottom = button.getMarginBottom();
       
      Returns:
      The bottom margin of the button in pixels.
    • setMarginBottom

      public void setMarginBottom(double value)
      Sets the button's bottom margin in pixels relative to the cell.
      
       ButtonCellType button = new ButtonCellType();
       button.setMarginBottom(6);
       
      Parameters:
      value - The bottom margin of the button in pixels.