找回密码
 立即注册

QQ登录

只需一步,快速开始

nutstore
金牌服务用户   /  发表于:2023-12-5 15:53  /   查看:716  /  回复:4
1金币
https://gcdn.grapecity.com.cn/fo ... 5&fromuid=31720


根据这个教程的意思 我使用  getCommand 这个 API 去获取到了 command 的详细信息,但是没有 execute 这个执行函数? 那应该怎么去拦截并重写这一事件呢?

最佳答案

查看完整内容

您好,您可以参考SheetChanged事件来实现这个需求:

4 个回复

倒序浏览
最佳答案
最佳答案
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2023-12-5 15:53:35
来自 5#
您好,您可以参考SheetChanged事件来实现这个需求:
  1. spread.bind(GC.Spread.Sheets.Events.SheetChanged, function (sender, args) {
  2.   if (args.propertyName == "insertSheet") {
  3.     let sheetName = args.sheetName;
  4.     let sheet = spread.getSheetFromName(sheetName);

  5.     /** Add Table To New Sheet */
  6.     var sTable = sheet.tables.add(
  7.       "table1",
  8.       1,
  9.       1,
  10.       10,
  11.       5,
  12.       GC.Spread.Sheets.Tables.TableThemes.medium2
  13.     );
  14.   }
  15. });
复制代码
SpreadJS 17.0.8 | GcExcel 7.1.0 已发布~
回复 使用道具 举报
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2023-12-5 17:36:52
2#
您好,您这边是想具体根据insertSheet来实现一个什么样的需求?
SpreadJS 17.0.8 | GcExcel 7.1.0 已发布~
回复 使用道具 举报
nutstore
金牌服务用户   /  发表于:2023-12-5 19:25:44
3#
Joestar.Xu 发表于 2023-12-5 17:36
您好,您这边是想具体根据insertSheet来实现一个什么样的需求?

我需要在新建 sheet 的时候自动添加一个table上去
回复 使用道具 举报
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2023-12-6 10:13:36
4#
您好,问题已重现,这边调研一下,后续有进展我会在本贴中回复您。
SpreadJS 17.0.8 | GcExcel 7.1.0 已发布~
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部