您好,可以先获取CheckBoxList的items,然后创建一个RadioButtonList对象,将items设置到RadioButtonList这个对象中,最后将单元格的cellType设置为RadioButtonList即可:
- let c = new GC.Spread.Sheets.CellTypes.CheckBoxList();
- c.items([
- { text: "sample1", value: "1" },
- { text: "sample2", value: "2" },
- { text: "sample3", value: "3" },
- ]);
- sheet.setCellType(3, 2, c, GC.Spread.Sheets.SheetArea.viewport);
- let r = new GC.Spread.Sheets.CellTypes.RadioButtonList();
- r.items(sheet.getCell(3, 2).cellType().items());
- sheet.setCellType(3, 2, r, GC.Spread.Sheets.SheetArea.viewport);
复制代码 |