您好,可以参考如下代码
- const combo = new spreadNS.CellTypes.ComboBox();
- combo
- .editorValueType(spreadNS.CellTypes.EditorValueType.text);
- sheet.setValue(0, 3, "Result:");
- sheet.getCell(1, 2, spreadNS.SheetArea.viewport).cellType(combo);
- sheet.bind(GC.Spread.Sheets.Events.EditStarting, function (sender, args) {
- const {row, col} = args;
- if (row == 1 && col == 2) {
- combo.items([{text: 1, value: 1,},{text: 2, value: 2,}]);
-
- }
- });
复制代码 效果如下:
|