[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
立即试用
(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
表示一种单元格装饰。

单元格装饰可以包含折角和/或图标,用于直观标注单元格。将此类与 IRange.setDecoration(ICellDecoration) 一起使用,可以将装饰应用到单元格或单元格区域。这是 SpreadJS 特有功能,支持导出为 .sjs 和 .ssjson 格式。


 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)
      创建一个新的单元格装饰实例。
      Parameters:
      cornerFold - 折角。
      icons - 图标。
    • CellDecoration

      public CellDecoration(ICornerFold cornerFold)
      创建一个新的CellDecoration类实例。
      Parameters:
      cornerFold - 折角。
    • CellDecoration

      public CellDecoration(List<ICellDecorationIcon> icons)
      创建一个新的CellDecoration类实例。
      Parameters:
      icons - 图标。
  • Method Details

    • getCornerFold

      public ICornerFold getCornerFold()
      获取单元格装饰的折角。
      
       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:
      单元格装饰的折角。
    • getIcons

      public List<ICellDecorationIcon> getIcons()
      获取单元格装饰的图标。
      
       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:
      单元格装饰的图标。