您好,请参考下列代码:
- window.onload = function () {
- let designerConfig = JSON.parse(
- JSON.stringify(GC.Spread.Sheets.Designer.DefaultConfig)
- );
- let designer = new GC.Spread.Sheets.Designer.Designer(
- "gc-designer-container",
- designerConfig
- );
- let spread = designer.getWorkbook();
- let sheet = spread.getActiveSheet();
- sheet.getCell(0, 0).value("Hello World");
- let oldOpenMenu = spread.contextMenu.onOpenMenu;
- spread.contextMenu.onOpenMenu = function (
- menuData,
- itemsDataForShown,
- hitInfo,
- spread
- ) {
- oldOpenMenu.apply(this, arguments);
- console.log(itemsDataForShown);
- for (const element of itemsDataForShown) {
- const item = element;
- if (
- item.name == "gc.spread.contextMenu.deleteColumns" &&
- hitInfo.worksheetHitInfo.col <= 3
- ) {
- item.disable = true;
- }
- }
- };
- };
复制代码 |