TabSheetSettings.EnableCopyPaste

Syntax

EnableCopyPaste: Boolean

Description

The EnableCopyPaste property enables or disables copy and paste operations.

Comments

Use JSON or the setEnableCopyPaste method to set the property value, and the getEnableCopyPaste method to get the property value.

The property contains a Boolean value. If the property is True, copy and paste operations in the table are allowed, when it is False, these operations are not allowed.

By default this property is True.

Example

To execute the example, the HTML page must contain the TabSheet component named tabSheet (see. Example of Creating the TabSheet Component). Copy data from the cells of the first table row, then paste it to the cells with the coordinates (1, 0) and (0,1), managing the permission to execute copy and paste operations. Also, process the BeforeCopy and BeforePaste events:

// Handle the BeforeCopy event
tabSheet.BeforeCopy.add(
    function(sender, args){
        console.log("Copy the next text: " + args.PlaintText);    
    }
);
// Handle the BeforePaste event
tabSheet.BeforePaste.add(
    function(sender, args){
        console.log("Starting insert coordinate: (" + args.StartCoord.rowIndex + ", " + args.StartCoord.colIndex + ")");    
    }
);
// Get the cell range with the first row
var range = tabSheet.getRange(0, 0, 2, 0);
// Select the first row
tabSheet.select(range, false);
// Enable data copying
tabSheet.setEnableCopyPaste(true);
// Enable synchronous data loading on copying not loaded cells
tabSheet.setSyncLoadClipboardData(true);
// Determine paste mode with formatting
tabSheet.setPasteMode(PP.Ui.PasteMode.ContentAndStyle);
// Get data with the selected range
var values = tabSheet.copy();
// Paste data to the cell with coordinates (1, 0);
tabSheet.paste(escape(values), 1, 0);
// Now disable to paste data
tabSheet.setEnableCopyPaste(false);
// Paste data to the cell with the coordinates (1, 1);
tabSheet.paste(escape(values), 1, 1);

After executing the example a formatted text with the data copied from the cells of the first table row is pasted to the cell under coordinates (1, 0):

After processing the BeforyCopy and BeforePast event handlers, the browser console shows the following messages:

Following text is copied: 16905 3912 9242
Starting paste coordinate: (1, 0)

See also:

TabSheetSettings