Class: SpreadsheetEditorClipboard

Core.SpreadsheetEditor. SpreadsheetEditorClipboard

Facilitates standard clipboard operations such as copy, cut, and paste, while preserving cell data, formatting, and styling.

new SpreadsheetEditorClipboard()

Example
const { Core } = window.getInstance();
const { documentViewer, SpreadsheetEditor } = Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(SpreadsheetEditor.SpreadsheetEditorManager.Events.SPREADSHEET_EDITOR_READY, () => {
  const spreadsheetEditorDocument = documentViewer.getDocument().getSpreadsheetEditorDocument();
  const spreadsheetEditorClipboard = spreadsheetEditorDocument.getClipboard();
});

Methods


canCopy()

Checks if the copy to clipboard operation can be performed.
Returns:
Returns true if the copy to clipboard can be performed; otherwise, false.
Type
boolean
Example
const { Core } = window.getInstance();
const spreadsheetEditorManager = Core.documentViewer.getSpreadsheetEditorManager();
const spreadsheetEditorClipboard = spreadsheetEditorDocument.getClipboard();
const canCopy = spreadsheetEditorClipboard.canCopy();
if (canCopy) {
  ... // Perform copy operation
}

canCut()

Checks if the cut operation can be performed.
Returns:
Returns true if the cut operation can be performed; otherwise, false.
Type
boolean
Example
const { Core } = window.getInstance();
const spreadsheetEditorManager = Core.documentViewer.getSpreadsheetEditorManager();
const spreadsheetEditorClipboard = spreadsheetEditorDocument.getClipboard();
const canCut = spreadsheetEditorClipboard.canCut();
if (canCut) {
  ... // Perform cut operation
}

canPaste()

Checks if the clipboard contains data that can be pasted.
Returns:
Returns true if the paste operation can be performed; otherwise, false.
Type
boolean
Example
const { Core } = window.getInstance();
const spreadsheetEditorManager = Core.documentViewer.getSpreadsheetEditorManager();
const spreadsheetEditorClipboard = spreadsheetEditorDocument.getClipboard();
const canPaste = spreadsheetEditorClipboard.canPaste();
if (canPaste) {
  ... // Perform paste operation
}

copy()

Copies the currently selected content to the clipboard.
Returns:
Type
void
Example
const { Core } = window.getInstance();
const spreadsheetEditorManager = Core.documentViewer.getSpreadsheetEditorManager();
const spreadsheetEditorClipboard = spreadsheetEditorDocument.getClipboard();
if (spreadsheetEditorClipboard.canCopy()) {
  spreadsheetEditorClipboard.copy();
}

cut()

Cuts the currently selected content from the SheetEditor and placing it on the clipboard.
Returns:
Type
void
Example
const { Core } = window.getInstance();
const spreadsheetEditorManager = Core.documentViewer.getSpreadsheetEditorManager();
const spreadsheetEditorClipboard = spreadsheetEditorDocument.getClipboard();
spreadsheetEditorClipboard.cut();

paste()

Pastes content from the clipboard.
Returns:
A promise that resolves when the paste operation is complete.
Type
Promise.<void>
Example
const { Core } = window.getInstance();
const spreadsheetEditorManager = Core.documentViewer.getSpreadsheetEditorManager();
const spreadsheetEditorClipboard = spreadsheetEditorDocument.getClipboard();
if (spreadsheetEditorClipboard.canPaste()) {
  await spreadsheetEditorClipboard.paste();
}