[]
        
(Showing Draft Content)

CellDecoration

Class CellDecoration

java.lang.Object
com.grapecity.documents.excel.CellDecoration
All Implemented Interfaces:
ICellDecoration

public class CellDecoration extends Object implements ICellDecoration
Represents a cell decoration.

A cell decoration can include a corner fold and/or icons to visually annotate cells. Use this class with IRange.setDecoration(ICellDecoration) to apply decorations to a cell or range of cells. This is a SpreadJS-specific feature, supported for export to .sjs and .ssjson formats.


 ICornerFold cornerFold = new CornerFold(Color.GetRed(), EnumSet.of(CornerPosition.LeftTop), 8);
 ICellDecorationIcon icon = new CellDecorationIcon("data:image/svg+xml;base64,PHN2Zz4=", 12, 12, IconPosition.OutsideRight);
 CellDecoration decoration = new CellDecoration(cornerFold, Collections.singletonList(icon));
 worksheet.getRange("A1").setDecoration(decoration);
 
  • Constructor Details

    • CellDecoration

      public CellDecoration(ICornerFold cornerFold, List<ICellDecorationIcon> icons)
      Creates a new instance of the CellDecoration class.
      Parameters:
      cornerFold - The corner fold.
      icons - The icons.
    • CellDecoration

      public CellDecoration(ICornerFold cornerFold)
      Creates a new instance of the CellDecoration class.
      Parameters:
      cornerFold - The corner fold.
    • CellDecoration

      public CellDecoration(List<ICellDecorationIcon> icons)
      Creates a new instance of the CellDecoration class.
      Parameters:
      icons - The icons.
  • Method Details

    • getCornerFold

      public ICornerFold getCornerFold()
      Gets the corner fold of the cell decoration.
      
       ICornerFold cornerFold = new CornerFold(Color.GetRed(), EnumSet.of(CornerPosition.LeftTop), 8);
       CellDecoration decoration = new CellDecoration(cornerFold);
       ICornerFold actualCornerFold = decoration.getCornerFold();
       
      Specified by:
      getCornerFold in interface ICellDecoration
      Returns:
      The corner fold of the cell decoration.
    • getIcons

      public List<ICellDecorationIcon> getIcons()
      Gets the icons of the cell decoration.
      
       ICellDecorationIcon icon = new CellDecorationIcon(
           "data:image/svg+xml;base64,PHN2Zz4=", 12, 12, IconPosition.OutsideRight);
       CellDecoration decoration = new CellDecoration(Collections.singletonList(icon));
       List<ICellDecorationIcon> icons = decoration.getIcons();
       
      Specified by:
      getIcons in interface ICellDecoration
      Returns:
      The icons of the cell decoration.