Copy/paste mutliple editable cells


I try to copy/paste multiple cells. By using mouse or keyboard, I want to select multiple cells (different columns and rows). Cells are contiguous, source and destination rectangle must be the same.

All cells are editable (OnCanEditCell event) and using inplace editor (OnGetEditorType, OnGetEditorProp, and OnCellValidate event).

I set:
- Navigation.AllowClipboardShortCuts to true.
- Options.goRangeSelect to True

I am sorry to ask you this because it must be simple but I didn't found how to do this.


Did you set goEditing = true in grid.Options?
If not, please set grid.Navigation.AllowClipboardAlways = true

Thanks, it works, it paste my rectangle selection.

I can select cells with keyboard but I want also select multiplie cells with mouse. For the moment, mouse can only select one cell: selection must be only contiguous.


If you want both cell range selection and editing, please set

grid.MouseActions.RangeSelectAndEdit = true


Is it possible to copy 1 cell value into multiples cells ? In my case, I copy one cell then I select many cells (by mouse or keyboard). When I paste, only the first row of my selection is pasted.

I tried to paste other rows with ClipboardPasteDone event but rect is only one destination cell.


There is a built-in feature to do this.
It can be setup with:

  advstringgrid1.Navigation.AllowClipboardAlways := true;
  advstringgrid1.Navigation.AllowClipboardShortCuts := true;
  advstringgrid1.Navigation.AllowSmartClipboard := true;
  advstringgrid1.Cells[1,1] := '1';

Select cell 1,1 and select a different range of cells and paste to see it in use.

It works very well.