Hi,
Yes, you can achieve your requirement by applying the following code in your application.
Code snippet [C#]:
void SampleGridControl_PreviewKeyDown(object sender, KeyEventArgs e)
{
bool IsCtrlKey = (e.KeyboardDevice.Modifiers & ModifierKeys.Control) != ModifierKeys.None;
if (IsCtrlKey)
{
if (e.Key == Key.V)
{
if (this.Model.SelectedRanges.Count > 0)
{
string buffer = Clipboard.GetText();
foreach (GridRangeInfo Range in this.Model.SelectedRanges)
{
if (Range.IsCols == true)
{
int Current_Column = Range.Left;
for (int Row = 1; Row < this.Model.RowCount; Row++)
{
this.PasteTextRowCol(Row, Current_Column, buffer);
}
}
else if (Range.IsRows == true)
{
int Current_Row = Range.Top;
for (int Column = 1; Column < this.Model.ColumnCount; Column++)
{
this.PasteTextRowCol(Current_Row, Column, buffer);
}
}
else
{
for (int Row = Range.Top; Row <= Range.Bottom; Row++)
{
for (int Column = Range.Left; Column <= Range.Right; Column++)
{
this.PasteTextRowCol(Row, Column, buffer);
}
}
}
}
e.Handled = true;
}
}
}
}
private bool PasteTextRowCol(int rowIndex, int colIndex, string text)
{
bool state = false;
foreach (GridControlBase grid in this.Model.Views)
{
if (grid != null)
{
grid.CurrentCell.MoveTo(rowIndex, colIndex);
GridStyleInfo style = this.Model[rowIndex, colIndex];
state = style.ApplyFormattedText(text, GridCellBaseTextInfo.PasteText);
grid.CurrentCell.BeginEdit();
grid.CurrentCell.Deactivate();
}
}
return state;
}
And also we have modified your sample as per your requirement please find the modified sample under the following location.
Sample:
http://www.syncfusion.com/uploads/redirect.aspx?file=Multicellpaste GDC_89ac4b5f.rar&team=testingftp
Please let us know if this helps.
Regards,
Ramesh