Posted 2 October 2018, 4:00 pm EST
Hi,
We need make sure not to edit workbook styles with copy-paste and cut-paste.
For this reason, as mentionned in the documentation we used following property to handle the paste case.
worksheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
The copy is not a problem because it does not modify the sources cells. However, the cut is problematic. To override the feature, I tried some modifier version of http://help.grapecity.com/spread/SpreadSheets11/webframe.html#sccopy.html
spread.commandManager().register('cut', (args) => {
let activeWorksheet = spread.getActiveSheet();
spread.commandManager().execute({ cmd: 'copy' });
for (let selection of activeWorksheet.getSelections()) {
activeWorksheet.clear(selection.row,
selection.col,
selection.rowCount,
selection.colCount,
GC.Spread.Sheets.SheetArea.viewport,
GC.Spread.Sheets.StorageType.data);
}
this.isDirty = true;
});
// Remove original cut command
spread.commandManager().setShortcutKey(undefined, GC.Spread.Commands.Key.x, true, false, false, false);
spread.commandManager().setShortcutKey('cut', GC.Spread.Commands.Key.x, true, false, false, false);
However, sending the copy command, does not seem to do the same thing as Ctrl-C. It does not copy the whole range and add the green dashed style to the selection.
Am I using the copy command propertly to immitate Ctrl-C default behavior. To then delete the source range data and be able to paste the data as needed by the user.
Thanks