您可以参考以下代码:
- // 注册命令
- var command = {
- canUndo: true,
- execute: function (context, options, isUndo) {
- console.log(options);
- var row = options.row;
- var col = options.col;
- var cell = sheet.getCell(row,col);
- alert(row + ":" + col + ", value:" + cell.value());
- }
- }
- var commandManager = spread.commandManager();
- commandManager.register("buttons", command);
- //样式
- var style = new GC.Spread.Sheets.Style();
- style.cellButtons = [
- {
- imageType: GC.Spread.Sheets.ButtonImageType.ellipsis,
- command: "buttons"
- }
- ];
- sheet.setStyle(10, 2, style);
复制代码 导出ssjson再次导入时,需要重新注册此命令
- var command = {
- canUndo: true,
- execute: function (context, options, isUndo) {
- console.log(options);
- var row = options.row;
- var col = options.col;
- var cell = sheet.getCell(row,col);
- alert(row + ":" + col + ", value:" + cell.value());
- }
- }
- var commandManager = spread.commandManager();
- commandManager.register("buttons", command);
复制代码
|