本帖最后由 xcymoo 于 2022-11-10 15:50 编辑
- spread.commandManager().register(
- 'fillDown',
- {
- canUndo: true,
- execute: (context, options, isUndo) => {
- var Commands = GC.Spread.Sheets.Commands;
- spread.suspendEvent();
- if (isUndo) {
- Commands.undoTransaction(context, options);
- spread.resumeEvent();
- return true
- } else {
- Commands.startTransaction(context, options);
- const sheet = spread.getActiveSheet();
- const { row, col, rowCount, colCount } = sheet.getSelections()[0];
- let startRange, wholeRange;
- for (let i = 0; i < colCount; i++) {
- startRange = new GC.Spread.Sheets.Range(row, col + i, 1, 1);
- wholeRange = new GC.Spread.Sheets.Range(row, col + i, rowCount, 1);
- sheet.fillAuto(startRange, wholeRange, {
- fillType: 0,
- series: 0,
- direction: 3,
- });
- }
- Commands.endTransaction(context, options);
- spread.resumeEvent();
- return true
- }
- },
- },
- 68,
- false,
- true,
- true,
- false
- );
复制代码 帮您修改了一下,您看看 |