CopyPaste
Members
columnsLimit
copyPaste.columnsLimit : number
The maximum number of columns than can be copied to the clipboard.
Default: Infinity
pasteMode
copyPaste.pasteMode : string
When pasting:
'overwrite'- overwrite the currently-selected cells'shift_down'- move currently-selected cells down'shift_right'- move currently-selected cells to the right
Default: “overwrite”
rowsLimit
copyPaste.rowsLimit : number
The maximum number of rows than can be copied to the clipboard.
Default: Infinity
uiContainer
copyPaste.uiContainer : HTMLElement
The UI container for the secondary focusable element.
Methods
copy
copyPaste.copy([copyMode])
Copies the contents of the selected cells (and/or their related column headers) to the system clipboard.
Takes an optional parameter (copyMode) that defines the scope of copying:
copyMode value | Description |
|---|---|
'cells-only' (default) | Copy the selected cells |
'with-column-headers' | - Copy the selected cells - Copy the nearest column headers |
'with-column-group-headers' | - Copy the selected cells - Copy all related columns headers |
'column-headers-only' | Copy the nearest column headers (without copying cells) |
| Param | Type | Default | Description |
|---|---|---|---|
| [copyMode] | string | ”cells-only” | optional Copy mode. |
copyCellsOnly
copyPaste.copyCellsOnly()
Copies the contents of the selected cells.
copyColumnHeadersOnly
copyPaste.copyColumnHeadersOnly()
Copies the contents of column headers that are nearest to the selected cells.
copyWithAllColumnHeaders
copyPaste.copyWithAllColumnHeaders()
Copies the contents of the selected cells and all their related column headers.
copyWithColumnHeaders
copyPaste.copyWithColumnHeaders()
Copies the contents of the selected cells and their nearest column headers.
cut
copyPaste.cut()
Cuts the contents of the selected cells to the system clipboard.
destroy
copyPaste.destroy()
Destroys the CopyPaste plugin instance.
disablePlugin
copyPaste.disablePlugin()
Disables the CopyPaste plugin for your Handsontable instance.
enablePlugin
copyPaste.enablePlugin()
Enables the CopyPaste plugin for your Handsontable instance.
getRangedCopyableData
copyPaste.getRangedCopyableData(ranges) ⇒ string
Converts the contents of multiple ranges (ranges) into a single string.
| Param | Type | Description |
|---|---|---|
| ranges | Array<{startRow: number, startCol: number, endRow: number, endCol: number}> | Array of objects with properties startRow, endRow, startCol and endCol. |
Returns: string - A string that will be copied to the clipboard.
getRangedData
copyPaste.getRangedData(ranges, [useSourceData]) ⇒ Array<Array>
Converts the contents of multiple ranges (ranges) into an array of arrays.
| Param | Type | Default | Description |
|---|---|---|---|
| ranges | Array<{startRow: number, startCol: number, endRow: number, endCol: number}> | Array of objects with properties startRow, startCol, endRow and endCol. | |
| [useSourceData] | boolean | false | optional Whether to use the source data instead of the data. This will stringify objects as JSON. |
Returns: Array<Array> - An array of arrays that will be copied to the clipboard.
isEnabled
copyPaste.isEnabled() ⇒ boolean
Checks if the CopyPaste plugin is enabled.
This method gets called by Handsontable’s beforeInit hook.
If it returns true, the enablePlugin() method gets called.
paste
copyPaste.paste(pastableText, [pastableHtml])
Simulates the paste action.
For security reasons, modern browsers don’t allow reading from the system clipboard.
| Param | Type | Default | Description |
|---|---|---|---|
| pastableText | string | The value to paste, as a raw string. | |
| [pastableHtml] | string | "" | optional The value to paste, as HTML. |
setCopyableText
copyPaste.setCopyableText()
Prepares copyable text from the cells selection in the invisible textarea.
updatePlugin
copyPaste.updatePlugin()
Updates the state of the CopyPaste plugin.
Gets called when updateSettings()
is invoked with any of the following configuration options: