menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SpreadsheetCopyPaste - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SpreadsheetCopyPaste

    Represents the class which performs all the clipboard operations such as Cut/Copy/Paste in SfSpreadsheet.

    Inheritance
    System.Object
    GridCopyPaste
    SpreadsheetCopyPaste
    Implements
    System.IDisposable
    IPasteOptionChanged
    Inherited Members
    GridCopyPaste.Dispose()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Windows.Forms.Spreadsheet
    Assembly: Syncfusion.Spreadsheet.Windows.dll
    Syntax
    public class SpreadsheetCopyPaste : GridCopyPaste, IDisposable, IPasteOptionChanged

    Constructors

    SpreadsheetCopyPaste()

    Initializes a new SpreadsheetCopyPaste.

    Declaration
    public SpreadsheetCopyPaste()

    Properties

    AllowPasteOptionPopup

    Gets or sets whether the paste option popup will be shown or not after pasting.

    Declaration
    public bool AllowPasteOptionPopup { get; set; }
    Property Value
    Type Description
    System.Boolean

    True or False.

    ClipboardText

    Gets or sets the copied text in clipboard when we perform paste operation.

    Declaration
    protected string ClipboardText { get; set; }
    Property Value
    Type Description
    System.String

    Copied text.

    DefaultPasteOption

    Gets or sets the default paste option.

    Declaration
    public PasteOptions DefaultPasteOption { get; set; }
    Property Value
    Type Description
    PasteOptions

    One of the enum option in PasteOptions.

    PasteDropdownItem

    Gets or sets the dropdownitem of paste operation.

    Declaration
    protected PasteDropDownItem PasteDropdownItem { get; set; }
    Property Value
    Type Description
    PasteDropDownItem

    An instance of PasteDropDownItem.

    PasteRangeList

    Gets or sets the ranges which are selected for pasting.

    Declaration
    protected GridRangeInfoList PasteRangeList { get; set; }
    Property Value
    Type Description
    GridRangeInfoList

    List of ranges.

    SourceGrid

    Gets or sets the copied range from grid.

    Declaration
    protected SpreadsheetGrid SourceGrid { get; set; }
    Property Value
    Type Description
    SpreadsheetGrid

    An instance of SpreadsheetGrid.

    SourceRange

    Gets or sets the selected range which is used for copy/cut operation.

    Declaration
    protected GridRangeInfo SourceRange { get; set; }
    Property Value
    Type Description
    GridRangeInfo

    Selected range.

    SourceWorkbookRange

    Gets or sets the active sheet range of workbook when we perform cut/copy operation.

    Declaration
    protected IRange SourceWorkbookRange { get; set; }
    Property Value
    Type Description
    IRange

    Sheet range.

    TargetRange

    Gets or sets the selected ranges which is used for paste operation.

    Declaration
    protected GridRangeInfo TargetRange { get; set; }
    Property Value
    Type Description
    GridRangeInfo

    Selected range.

    TargetWorkbookRange

    Gets or sets the active sheet range of workbook when we perform paste operation.

    Declaration
    protected IRange TargetWorkbookRange { get; set; }
    Property Value
    Type Description
    IRange

    Sheet range.

    TempWorkbookRange

    Gets or sets the temp sheet range of workbook when we perform paste operation.

    Declaration
    protected IRange TempWorkbookRange { get; set; }
    Property Value
    Type Description
    IRange

    Sheet range.

    Methods

    CanCopy()

    Checks whether the selected range can be copied or not

    Declaration
    protected virtual bool CanCopy()
    Returns
    Type Description
    System.Boolean

    True or False.

    CanCut()

    Checks if the selected range can be cut or copied to the clipboard.

    Declaration
    protected virtual bool CanCut()
    Returns
    Type Description
    System.Boolean

    True or False.

    CanPaste(GridRangeInfoList)

    Checks whether the copied ranges can be pasted.

    Declaration
    protected virtual bool CanPaste(GridRangeInfoList mrangeList)
    Parameters
    Type Name Description
    GridRangeInfoList mrangeList

    Currently selected rangelist.

    Returns
    Type Description
    System.Boolean

    True or False.

    CheckMergedCells()

    Determines whether the merged cells is present in the pasted region and updates the pasted range.

    Declaration
    protected bool CheckMergedCells()
    Returns
    Type Description
    System.Boolean

    True or false.

    CheckPasswordProtected(IRange)

    Returns the specified range is locked or not.

    Declaration
    protected bool CheckPasswordProtected(IRange range)
    Parameters
    Type Name Description
    IRange range

    Selected range.

    Returns
    Type Description
    System.Boolean

    True or False.

    ClearClipboard(Boolean)

    To clear the clipboard values.

    Declaration
    protected virtual void ClearClipboard(bool clear = true)
    Parameters
    Type Name Description
    System.Boolean clear

    If true, clears the clipboard.

    CommitTransaction(GridRangeInfoList)

    Commit transaction.

    Declaration
    protected void CommitTransaction(GridRangeInfoList rangeList)
    Parameters
    Type Name Description
    GridRangeInfoList rangeList

    List of pasted ranges

    Copy()

    This function performs the copy operation in .

    Declaration
    public override void Copy()
    Overrides
    GridCopyPaste.Copy()

    Copy(GridRangeInfo, Boolean)

    Copy the values from the given range.

    Declaration
    public override void Copy(GridRangeInfo range, bool needToCut)
    Parameters
    Type Name Description
    GridRangeInfo range

    Currently selected range.

    System.Boolean needToCut

    Determines whether to cut/copy.

    Overrides
    GridCopyPaste.Copy(GridRangeInfo, Boolean)

    CopyToClipboard(GridRangeInfo)

    Copies the text to the clipboard.

    Declaration
    protected void CopyToClipboard(GridRangeInfo copyRange)
    Parameters
    Type Name Description
    GridRangeInfo copyRange

    Copied range.

    CopyToTargetrange(PasteOptions)

    Perform the paste operation based on the option provided.

    Declaration
    protected void CopyToTargetrange(PasteOptions e)
    Parameters
    Type Name Description
    PasteOptions e

    Selected paste option.

    CopyToTemprange(ICollection, String)

    Copy the specified source range into target range.

    Declaration
    protected void CopyToTemprange(ICollection rangeList, string excelTargetRange)
    Parameters
    Type Name Description
    System.Collections.ICollection rangeList

    Selected ranges to paste.

    System.String excelTargetRange

    Excel range to paste.

    Cut()

    This function performs the cut operation in SpreadsheetGrid.

    Declaration
    public override void Cut()
    Overrides
    GridCopyPaste.Cut()

    Dispose(Boolean)

    Releases all resources used by the. SpreadsheetCopyPaste.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing
    Overrides
    GridCopyPaste.Dispose(Boolean)

    GetExpandedRange(GridRangeInfoList)

    Expands the Range list when it is Table, Rows, Cols to Cells.

    Declaration
    protected GridRangeInfoList GetExpandedRange(GridRangeInfoList rangeList)
    Parameters
    Type Name Description
    GridRangeInfoList rangeList

    The currently selected range.

    Returns
    Type Description
    GridRangeInfoList

    List of selected ranges.

    GetPasteDropDownItem()

    To get the PasteDropDown control.

    Declaration
    protected virtual PasteDropDownItem GetPasteDropDownItem()
    Returns
    Type Description
    PasteDropDownItem

    An instance of PasteDropDownItem.

    MoveToTargetrange(ICollection)

    Move the specified source range into target range.

    Declaration
    protected void MoveToTargetrange(ICollection rangeList)
    Parameters
    Type Name Description
    System.Collections.ICollection rangeList

    Selected ranges to paste.

    OnCopied(SpreadsheetCopiedEventArgs)

    Invoked after copied the content from .

    Declaration
    protected virtual void OnCopied(SpreadsheetCopiedEventArgs args)
    Parameters
    Type Name Description
    SpreadsheetCopiedEventArgs args

    A SpreadsheetCopiedEventArgs that contains the event data.

    Remarks

    This method raises the Copied event.

    OnCopying(SpreadsheetCopyingEventArgs)

    Invoked while copying the content from .

    Declaration
    protected virtual bool OnCopying(SpreadsheetCopyingEventArgs args)
    Parameters
    Type Name Description
    SpreadsheetCopyingEventArgs args

    A SpreadsheetCopyingEventArgs that contains the event data.

    Returns
    Type
    System.Boolean
    Remarks

    This method raises the Copying event.

    OnPasted(SpreadsheetPastedEventArgs)

    Invoked after pasted the content in .

    Declaration
    protected virtual void OnPasted(SpreadsheetPastedEventArgs args)
    Parameters
    Type Name Description
    SpreadsheetPastedEventArgs args

    A SpreadsheetPastedEventArgs that contains the event data.

    Remarks

    This method raises the Pasted event.

    OnPasting(SpreadsheetPastingEventArgs)

    Invoked while pasting the content in .

    Declaration
    protected virtual bool OnPasting(SpreadsheetPastingEventArgs args)
    Parameters
    Type Name Description
    SpreadsheetPastingEventArgs args

    A SpreadsheetPastingEventArgs that contains the event data.

    Returns
    Type
    System.Boolean
    Remarks

    This method raises the Pasting event.

    Paste()

    This function Performs the Paste operation in .

    Declaration
    public override void Paste()
    Overrides
    GridCopyPaste.Paste()

    Paste(GridRangeInfoList)

    To paste the values in the given range.

    Declaration
    public void Paste(GridRangeInfoList range)
    Parameters
    Type Name Description
    GridRangeInfoList range

    Selected rangelist.

    Paste(GridRangeInfoList, PasteOptions)

    To paste the values based on the option in the given range.

    Declaration
    public void Paste(GridRangeInfoList range, PasteOptions e)
    Parameters
    Type Name Description
    GridRangeInfoList range

    List of selected ranges.

    PasteOptions e

    Selected Option.

    PasteFromClipboard(GridRangeInfo)

    Pastes the text from clipboard.

    Declaration
    protected override void PasteFromClipboard(GridRangeInfo range)
    Parameters
    Type Name Description
    GridRangeInfo range

    An instance of GridRangeInfo.

    Overrides
    GridCopyPaste.PasteFromClipboard(GridRangeInfo)

    PasteOptionChanged(PasteOptions)

    This function is invoked when the pasteoptions button is clicked.

    Declaration
    public void PasteOptionChanged(PasteOptions e)
    Parameters
    Type Name Description
    PasteOptions e

    Option which the user selects.

    UpdateMergeRange()

    Update the pasted merge range.

    Declaration
    protected void UpdateMergeRange()

    UpdateSelection(IEnumerable<GridRangeInfo>)

    Updates the selection frame in SpreadsheetGrid.

    Declaration
    protected void UpdateSelection(IEnumerable<GridRangeInfo> mrangeList)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<GridRangeInfo> mrangeList

    List of the pasted ranges.

    UpdateTableSelectedRange()

    Returns Table range selected partially or not?.

    Declaration
    protected bool UpdateTableSelectedRange()
    Returns
    Type Description
    System.Boolean

    True or False.

    UpdateTargetRange(String)

    Updates the target range.

    Declaration
    protected bool UpdateTargetRange(string excelTargetRange)
    Parameters
    Type Name Description
    System.String excelTargetRange

    Selected excel range.

    Returns
    Type
    System.Boolean

    Events

    Copied

    Occurs after copied the content from the .

    Declaration
    public event SpreadsheetCopiedEventHandler Copied
    Event Type
    Type
    SpreadsheetCopiedEventHandler

    Copying

    Occurs while copying the content from the .

    Declaration
    public event SpreadsheetCopyingEventHandler Copying
    Event Type
    Type
    SpreadsheetCopyingEventHandler

    Pasted

    Occurs after the content is pasted into .

    Declaration
    public event SpreadsheetPastedEventHandler Pasted
    Event Type
    Type
    SpreadsheetPastedEventHandler

    Pasting

    Occurs while pasting the content into .

    Declaration
    public event SpreadsheetPastingEventHandler Pasting
    Event Type
    Type
    SpreadsheetPastingEventHandler

    Implements

    System.IDisposable
    IPasteOptionChanged
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved