Back to Devexpress

SpreadsheetControl.CopiedRangePasting Event

wpf-devexpress-dot-xpf-dot-spreadsheet-dot-spreadsheetcontrol-73993cd6.md

latest3.2 KB
Original Source

SpreadsheetControl.CopiedRangePasting Event

Occurs before the range content is pasted into target cells.

Namespace : DevExpress.Xpf.Spreadsheet

Assembly : DevExpress.Xpf.Spreadsheet.v25.2.dll

NuGet Package : DevExpress.Wpf.Spreadsheet

Declaration

csharp
public event CopiedRangePastingEventHandler CopiedRangePasting
vb
Public Event CopiedRangePasting As CopiedRangePastingEventHandler

Event Data

The CopiedRangePasting event's data class is CopiedRangePastingEventArgs. The following properties provide information specific to this event:

PropertyDescription
CancelGets or sets a value indicating whether the operation of pasting data should be canceled.
IsCutGets or sets a value indicating whether the copied data is cut from the source range.
PasteSpecialFlagsGets or sets the part of copied data to be pasted into target range.
TargetRangeGets the cell range into which data are going to be pasted.

Remarks

Handle the CopiedRangePasting event to perform any actions before the content of copied cells is pasted into the target range. The event parameters allow you define paste options, specify whether the cut operation should be performed, or cancel the paste operation.

The SpreadsheetControl.CopiedRangePasted event is raised when the paste operation is completed.

The code sample below shows how to insert only cell values if the range is pasted to the specific cell range:

csharp
using DevExpress.Spreadsheet;

private void spreadsheetControl_CopiedRangePasting(object sender,
  s CopiedRangePastingEventArgs e)
{
    if (e.TargetRange.IsIntersecting
      (spreadsheetControl.Document.Range["A1:B5"])) 
    {
        e.PasteSpecialFlags = PasteSpecial.Values;
    }
}
vb
Imports DevExpress.Spreadsheet

Private Sub spreadsheetControl_CopiedRangePasting(ByVal sender As Object, ByVal e As CopiedRangePastingEventArgs)
  If e.TargetRange.IsIntersecting
    (spreadsheetControl.Document.Range("A1:B5")) Then
    e.PasteSpecialFlags = PasteSpecial.Values
  End If
End Sub

See Also

CopiedRangePasted

SpreadsheetControl Class

SpreadsheetControl Members

DevExpress.Xpf.Spreadsheet Namespace