以下是三种控件的代码:
1、日期控件:
- let notShowTimestyle = new GC.Spread.Sheets.Style();
- notShowTimestyle.cellButtons = [{
- imageType: GC.Spread.Sheets.ButtonImageType.dropdown,
- command: "openDateTimePicker",
- useButtonStyle: false,
- }];
- notShowTimestyle.dropDowns = [{
- type: GC.Spread.Sheets.DropDownType.dateTimePicker,
- option: {
- showTime: vm.showTime == '1'?true:false
- }
- }];
- activeSheet.setStyle(rowIndex, columnIndex, notShowTimestyle);
复制代码
2、下拉框:
- setDropDownToSheet: function (activeSheet, rowIndex, colIndex,dropSourceArray) {
- const {GC} = window;
- let cellButtons = [
- {
- imageType: GC.Spread.Sheets.ButtonImageType.dropdown,
- command: "openList",
- useButtonStyle: true,
- }
- ];
- let dropDowns = [
- {
- type: GC.Spread.Sheets.DropDownType.list,
- option: {
- items: dropSourceArray,
- }
- }
- ]
- activeSheet.getRange(parseInt(rowIndex), parseInt(colIndex), 1, 1).cellButtons(cellButtons).dropDowns(dropDowns);
- },
复制代码
3、复选框:
- const checkBoxCellType = new GC.Spread.Sheets.CellTypes.CheckBox();
- checkBoxCellType.isThreeState(false);
- checkBoxCellType.caption(vm.checkBoxCaption);
- checkBoxCellType.textAlign(vm.checkBoxPlace); activeSheet.setCellType(rowIndex, columnIndex, checkBoxCellType);
复制代码
|