找回密码
 立即注册

QQ登录

只需一步,快速开始

liujun

注册会员

24

主题

41

帖子

145

积分

注册会员

积分
145
liujun
注册会员   /  发表于:2021-12-7 21:43  /   查看:1565  /  回复:3
10金币
您好,我要在一个单元格里加入icon图片和文字,要加入一个图标、以及金额,请问有什么好的方法吗?谢谢!
image.png540892333.png

最佳答案

查看完整内容

您好, 可以使用单元格按钮实现单元格内 图标+文字。API:https://demo.grapecity.com.cn/spreadjs/help/api/GC.Spread.Sheets.Style.html#cellButtons 示例代码: 实现效果: 具体请参考学习指南: https://demo.grapecity.com.cn/spreadjs/SpreadJSTutorial/features/cells/cell-buttons/purejs

3 个回复

倒序浏览
最佳答案
最佳答案
Lynn.Dou讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2021-12-7 21:43:15
来自 2#
您好,
可以使用单元格按钮实现单元格内 图标+文字。API:https://demo.grapecity.com.cn/sp ... le.html#cellButtons
示例代码:
  1. var sheet = spread.getActiveSheet()
  2. var style = new GC.Spread.Sheets.Style();
  3. //style.locked = true;
  4. style.cellButtons = [
  5.         {
  6.                 useButtonStyle: false,
  7.                 position: GC.Spread.Sheets.ButtonPosition.left,
  8.                 imageType: GC.Spread.Sheets.ButtonImageType.custom,
  9.                 imageSrc: "https://img0.baidu.com/it/u=3101694723,748884042&fm=26&fmt=auto&gp=0.jpg",
  10.                 imageSize: {
  11.                         height: 15,
  12.                         width: 15
  13.                 },
  14.                 enabled: true
  15.         }
  16. ];
  17. sheet.setStyle(1,1,style);
  18. sheet.setValue(1,1,123);
  19. sheet.setFormatter(1,1,"¥#,##0.00")
  20. sheet.setColumnWidth(1,120)
复制代码
实现效果:
image.png625577697.png

具体请参考学习指南:
https://demo.grapecity.com.cn/sp ... cell-buttons/purejs
回复 使用道具 举报
liujun
注册会员   /  发表于:2021-12-8 10:43:49
3#
好的👌我试试。谢谢您!
回复 使用道具 举报
Lynn.Dou讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2021-12-8 11:52:51
4#
您客气了,有问题欢迎交流。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部