[]
        
(Showing Draft Content)

CellPadding

Class CellPadding

java.lang.Object
com.grapecity.documents.excel.CellPadding
All Implemented Interfaces:
ICellPadding

public class CellPadding extends Object implements ICellPadding
Represents the cell padding for a range.

Provides padding values (left, right, top, bottom) for cells. Can be created with uniform padding on all sides or with individual values for each side. This class is used with SpreadJS JSON I/O and PDF export.


 // Uniform padding on all sides
 CellPadding padding = new CellPadding(15);
 worksheet.getRange("A1").setCellPadding(padding);

 // Different padding for each side (top, right, bottom, left)
 CellPadding padding2 = new CellPadding(10, 20, 10, 20);
 worksheet.getRange("B1").setCellPadding(padding2);
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    CellPadding(int all)
    Creates cell padding with the same value on all sides.
    CellPadding(int top, int right, int bottom, int left)
    Creates cell padding with different values for each side.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the bottom cell padding.
    int
    Gets the left cell padding.
    int
    Gets the right cell padding.
    int
    Gets the top cell padding.

    Methods inherited from class java.lang.Object

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

    • CellPadding

      public CellPadding(int all)
      Creates cell padding with the same value on all sides.
      Parameters:
      all - The padding value for all sides.
    • CellPadding

      public CellPadding(int top, int right, int bottom, int left)
      Creates cell padding with different values for each side.
      Parameters:
      top - The integer value representing the top padding.
      right - The integer value representing the right padding.
      bottom - The integer value representing the bottom padding.
      left - The integer value representing the left padding.
  • Method Details

    • getLeft

      public int getLeft()
      Gets the left cell padding.
      
       CellPadding padding = new CellPadding(10, 20, 10, 5);
       int left = padding.getLeft();
       
      Specified by:
      getLeft in interface ICellPadding
      Returns:
      The left padding of the cell.
    • getRight

      public int getRight()
      Gets the right cell padding.
      
       CellPadding padding = new CellPadding(10, 20, 10, 5);
       int right = padding.getRight();
       
      Specified by:
      getRight in interface ICellPadding
      Returns:
      The right padding of the cell.
    • getTop

      public int getTop()
      Gets the top cell padding.
      
       CellPadding padding = new CellPadding(10, 20, 10, 5);
       int top = padding.getTop();
       
      Specified by:
      getTop in interface ICellPadding
      Returns:
      The top padding of the cell.
    • getBottom

      public int getBottom()
      Gets the bottom cell padding.
      
       CellPadding padding = new CellPadding(10, 20, 10, 5);
       int bottom = padding.getBottom();
       
      Specified by:
      getBottom in interface ICellPadding
      Returns:
      The bottom padding of the cell.