Spread Windows Forms 15.0
Spread Windows Forms 15.0 Product Documentation / Developer's Guide / Sheets / Customizing Clipboard Operation Options
In This Topic
    Customizing Clipboard Operation Options
    In This Topic

    There are several Clipboard operations (such as copy, cut, and paste) that are automatically set for a sheet with default settings; they are built-in to Spread. But Spread also gives you the ability to customize these operations on actual applications that you develop, depending on your specific needs. You can customize how the user can interact with the contents of the Clipboard when users perform copying and pasting actions in cells in the spreadsheet. You can implement those operations at your discretion in code. These customizations include:

    The following members are used to determine Clipboard-related interaction:

    The spreadsheet methods in the SheetView class that involve Clipboard operation are:

    The corresponding shape methods in the SheetView class that involve Clipboard operation are:

    If there are locked cells in the range to cut or paste then the Clipboard operation is not performed.

    The .NET version of the product handles Clipboard operations differently from the way that the COM version does.

    You can also set how some Clipboard-related features perform when the user is in edit mode in a cell on the Spread. You can set whether the pop-up menu appears while in edit mode within a cell using the AutoMenu property in SuperEditBase class and whether the user can perform Clipboard operations with the shortcut keys with the AllowClipboardKeys property in SuperEditBase class.

    For more information about copying and pasting, see Copying Data on a Sheet.

    Deactivating Clipboard Operations

    You can set whether the shortcut keys are available to the end user for them to use to perform Clipboard operations by setting the AutoClipboard property in the FpSpread class. You can deactivate all the Clipboard operations with components by setting the AutoClipboard property to False in the FpSpread class. The default setting is True. You can deactivate some Clipboard operations such as pasting (Ctrl+V) by deactivating the input map definition for short-cut keys and Clipboard operations (Ctrl+C, Ctrl+V, and Ctrl+X).

    Excluding Headers from Clipboard Operations

    You can set whether to include headers when using Clipboard operations by setting the ClipboardOptions property in the FpSpread class and the ClipboardOptions enumeration. The default setting, AllHeaders, allows all headers to be included.

    Obtaining the Clipboard Contents

    Values which are copied on sheets are controlled by the Clipboard class which is provided from the .NET Framework. You can obtain Clipboard contents by using respective operations in this Clipboard class.

    Cell data is copied onto the Clipboard in advance by calling ClipboardCopy method in the SheetView class at the Load event. Then, calling GetDataObject method enables you to obtain those Clipboard contents for use, such as for text format determination.

    Deactivating Pasting

    The ClipboardPasting event occurs when pasting is performed (Ctrl+V) on sheets. You can deactivate pasting by canceling this event under certain circumstances. You can prevent pasting by obtaining the timing when pasting is performed, and canceling the action.

    Changing the Scope of Pasting

    When cells are copied or cut to the Clipboard, all the data aspects including values, formats, and formulas, are available by default for pasting. You can configure to paste values only, for example, by changing the input map definitions. The default setting is ClipboardPasteAll, which enables pasting all the aspects of the data. The ClipboardPasteOptions enumeration allows you to set the scope of what is pasted when a Clipboard paste is performed by the user.

    Disabling Pasting in Invisible Cells

    You can set whether to paste the clipboard values in invisible cells, row, and columns by using the PasteSkipInvisibleRange option from the Features class. It accepts a boolean value and is False by default.

    This option only takes effect when RichClipboard is set to True.

    When PasteSkipInvisibleRange = True When PasteSkipInvisibleRange = False (default value)
    Pasting Data in Invisible Range Skip Pasting Data in Invisible Range

    The following example allows you to skip pasting the data in an invisible range.

    C#
    Copy Code
    fpSpread1.LegacyBehaviors = LegacyBehaviors.None;
    fpSpread1.Features.RichClipboard = true;
    fpSpread1.ActiveSheet.Rows[7].Visible = false;
    fpSpread1.ActiveSheet.Rows[10, 11].Visible = false;
    fpSpread1.AsWorkbook().Features.PasteSkipInvisibleRange = true;
    
    Visual Basic
    Copy Code
    fpSpread1.LegacyBehaviors = LegacyBehaviors.None
    fpSpread1.Features.RichClipboard = true
    fpSpread1.ActiveSheet.Rows(7).Visible = false
    fpSpread1.ActiveSheet.Rows(10, 11).Visible = false
    fpSpread1.AsWorkbook().Features.PasteSkipInvisibleRange = true
    

    Performing the Clipboard Operations in Code

    Various methods are provided in the SheetView class for Clipboard processes. You can run them when you want. These include:

    See Also