您好,请问您是像监听用户新建空白工作簿这个按钮吗,我们没有专门的事件去监听用户的这个操作,如果您还是期望实现这个需求,建议重写“空白单元格”按钮逻辑:
- // 自定义逻辑
- const fileMenuPanelCommand = GC.Spread.Sheets.Designer.getCommand(GC.Spread.Sheets.Designer.CommandNames.FileMenuPanel);// 获取文件按钮表盘
- const oldExecuteFn = fileMenuPanelCommand.execute;// 执行按钮获取
- // 重写执行逻辑
- fileMenuPanelCommand.execute = function (context, propertyName, newValue) {
- if (propertyName == "templateSetting") {
- alert('新增了新的文件')
- let designer = GC.Spread.Sheets.Designer.findControl(document.getElementById("gc-designer-container"));
- let spread = designer.getWorkbook();
- let sheet = spread.getActiveSheet();
- console.log(sheet.name())
- }
- oldExecuteFn.apply(this, arguments);
- }
- const config = GC.Spread.Sheets.Designer.DefaultConfig;
- config.commandMap = {
- fileMenuPanel: fileMenuPanelCommand
- }
- var designer = new GC.Spread.Sheets.Designer.Designer(_getElementById("gc-designer-container"), config);
复制代码 |
|