找回密码
 立即注册

QQ登录

只需一步,快速开始

strong

初级会员

19

主题

46

帖子

387

积分

初级会员

积分
387
strong
初级会员   /  发表于:2020-7-23 20:30  /   查看:3111  /  回复:5
1金币
image.png275536803.png

如截图的角标样式如何实现,希望不适用的批注或校验

最佳答案

查看完整内容

用自定义单元格可实现

5 个回复

倒序浏览
最佳答案
最佳答案
Fiooona
论坛元老   /  发表于:2020-7-23 20:30:31
来自 2#
image.png36254576.png
用自定义单元格可实现

CustomCellType_Base_Icon (1).html

3.22 KB, 下载次数: 54

组件化表格编辑器(预览版)试用进行中,点击了解详情!
请点击评分,对我的服务做出评价!5分为非常满意!
回复 使用道具 举报
strong
初级会员   /  发表于:2020-7-24 16:12:02
3#
好的,我试试,谢谢
回复 使用道具 举报
Fiooona
论坛元老   /  发表于:2020-7-24 16:25:52
4#
组件化表格编辑器(预览版)试用进行中,点击了解详情!
请点击评分,对我的服务做出评价!5分为非常满意!
回复 使用道具 举报
strong
初级会员   /  发表于:2020-7-27 20:49:56
5#
Fiooona 发表于 2020-7-24 10:29
用自定义单元格可实现
  1. const { CellTypes } = GC.Spread.Sheets;

  2. export class CornerMarkCell extends CellTypes.Text {
  3.   typeName = 'CornerMarkCell';

  4.   showEffect = false;

  5.   constructor(props) {
  6.     super();
  7.     const { showEffect = false } = props;
  8.     this.showEffect = showEffect;
  9.   }

  10.   paint(context, value, x1, y1, a1, b1, style, ctx) {
  11.     if (!context) {
  12.       return;
  13.       }
  14.       if(this.showEffect){
  15.           context.save();
  16.           let base = a1 > b1 ? b1 / 2 : a1 / 2;
  17.           context.beginPath();
  18.           context.moveTo(x1 + a1, y1);
  19.           context.lineTo(x1 + a1, y1 + base);
  20.           context.lineTo(x1 + a1 - base, y1);

  21.           context.fillStyle ='red';
  22.           context.fill();
  23.           context.closePath();
  24.           context.restore();
  25.       }

  26.     CellTypes.Text.prototype.paint.apply(this, [context, value, x1, y1, a1, b1, style, ctx]);
  27.   }


  28. const sheet = workbook.getActiveSheet();
  29. sheet.setCellType(0, 1, new CornerMarkCell({ showEffect: true }));
  30. }
复制代码


你好,我这么写为啥不生效
回复 使用道具 举报
Fiooona
论坛元老   /  发表于:2020-7-27 21:45:46
6#
给个能运行的Demo吧,方便调试
组件化表格编辑器(预览版)试用进行中,点击了解详情!
请点击评分,对我的服务做出评价!5分为非常满意!
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部