TabSheet.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 the 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:

// Process the BeforeCopy event
tabSheet.BeforeCopy.add(
    function(sender, args){
        console.log("The following text is copied: " + args.PlaintText);    
    }
);
// Process the BeforePaste event
tabSheet.BeforePaste.add(
    function(sender, args){
        console.log("Start paste coordinate: (" + args.StartCoord.rowIndex + ", " + args.StartCoord.colIndex + ")");    
    }
);
// Get a 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 of unloaded cells
tabSheet.setSyncLoadClipboardData(True);
// Determine paste mode with formatting
tabSheet.setPasteMode(PP.Ui.PasteMode.ContentAndStyle);
// Get selected range data
var values = tabSheet.copy();
// Paste data to the cell with coordinates (1, 0);
tabSheet.paste(escape(values), 1, 0);
// Then prohibit data paste
tabSheet.setEnableCopyPaste(False);
// Paste data to the cell with 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:

TabSheet