Posted 27 November 2020, 12:57 pm EST
How do I fill down with CTRL+D or COMMAND+D (mac)
See reference below:
https://support.microsoft.com/en-us/office/keyboard-shortcuts-in-excel-1798d9d5-842a-42b8-9c99-9b7213f0040f#PickTab=Windows
Forums Home / Spread / SpreadJS
Posted by: jeff on 27 November 2020, 12:57 pm EST
Posted 27 November 2020, 12:57 pm EST
How do I fill down with CTRL+D or COMMAND+D (mac)
See reference below:
https://support.microsoft.com/en-us/office/keyboard-shortcuts-in-excel-1798d9d5-842a-42b8-9c99-9b7213f0040f#PickTab=Windows
Posted 30 November 2020, 11:55 pm EST
Hi Jeff,
You may create your own custom command which performs the fill down on ctrl+D. Please refer to the following g code snippet and attached sample that demonstrates the same.
var command = {
canUndo: true,
execute: function (spread, options, isUndo) {
var Commands = GC.Spread.Sheets.Commands;
if (isUndo) {
Commands.undoTransaction(spread, options);
return true;
} else {
Commands.startTransaction(spread, options);
spread.suspendPaint();
let selections = spread.getActiveSheet().getSelections();
options.cmd = "ctrlFill";
selections.forEach((sel) => {
let srange = new GC.Spread.Sheets.Range(
sel.row,
sel.col,
1,
sel.colCount
);
let drange = new GC.Spread.Sheets.Range(
sel.row + 1,
sel.col,
sel.rowCount - 1,
sel.colCount
);
spread.commandManager().execute({
cmd: "fill",
sheetName: spread.getActiveSheet().name(),
startRange: srange,
fillRange: drange,
autoFillType: GC.Spread.Sheets.Fill.AutoFillType.fillSeries,
fillDirection: GC.Spread.Sheets.Fill.FillDirection.down
});
});
spread.resumePaint();
Commands.endTransaction(spread, options);
return true;
}
}
```0
sample: https://codesandbox.io/s/lucid-raman-1ydsm?file=/src/index.js:190-1432
API Reference:
Custom Commands Demo: https://www.grapecity.com/spreadjs/demos/features/worksheet/actions/custom-action#demo_source_name
Regards
Avinash