Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 35 additions & 29 deletions Document-Processing/Excel/Spreadsheet/Javascript-ES5/clipboard.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,53 @@
---
layout: post
title: Clipboard in EJ2 Javascript Spreadsheet control | Syncfusion
description: Learn here all about Clipboard in Syncfusion EJ2 Javascript Spreadsheet control of Syncfusion Essential JS 2 and more.
title: Clipboard in EJ2 JavaScript Spreadsheet control | Syncfusion
description: Learn here all about Clipboard in Syncfusion EJ2 JavaScript Spreadsheet control of Syncfusion Essential JS 2 and more.
platform: document-processing
control: Clipboard
control: Clipboard
documentation: ug
---

# Clipboard in EJ2 Javascript Spreadsheet control
# Clipboard in EJ2 JavaScript Spreadsheet control

The Spreadsheet provides support for the clipboard operations (cut, copy, and paste). Clipboard operations can be enabled or disabled by setting the [`enableClipboard`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/#enableclipboard) property in Spreadsheet.
The Spreadsheet provides support for the clipboard operations (cut, copy, and paste). Clipboard operations can be enabled or disabled by setting the [`enableClipboard`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet#enableclipboard) property in Spreadsheet.

> By default, the `enableClipboard` property is true.
> The default value for `enableClipboard` property is `true`.
## Cut

It is used to cut the data from selected range of cells, rows or columns in a spreadsheet and make it available in the clipboard.

**User Interface**:

Cut can be done in one of the following ways.
Cut can be performed in one of the following ways.

* Using Cut button in the Ribbon’s HOME tab to perform cut operation.
* Using Cut option in the Context Menu.
* Using `Ctrl + X` | `Command + X` keyboard shortcut.
* Select the range, then click the **Cut** button in the Ribbon’s HOME tab.
* Select the range, then choose **Cut** from the Context Menu.
* Select the range, then press `Ctrl + X` (Windows) or `Command + X` (Mac).

**Programmatically**:

* Using the [`cut`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet#cut) method.

* Using the [`cut`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/#cut) method.

## Copy

It is used to copy the data from selected range of cells, rows or columns in a spreadsheet and make it available in the clipboard.
It is used to copy the data from a selected range of cells, rows, or columns in the Spreadsheet and places it on the clipboard.

**User Interface**:

Copy can be done in one of the following ways.
Copy can be performed in one of the following ways:

* Using Copy button in the Ribbon’s HOME tab to perform copy operation.
* Using Copy option in the Context Menu.
* Using `Ctrl + C` | `Command + C` keyboard shortcut.
* Select the range, then click the **Copy** button in the Ribbon’s HOME tab.
* Select the range, then choose **Copy** from the Context Menu.
* Select the range, then press `Ctrl + C` (Windows) or `Command + C` (Mac).

* Using the [`copy`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/#copy) method.
**Programmatically**:

* Using the [`copy`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet#copy) method.

## Paste

It is used to paste the clipboard data to the selected range, rows or columns. You have the following options in Paste,
It is used to paste the clipboard data to the selected range, rows, or columns. The following options are available in the Paste dropdown:

* `Paste Special` - You can paste the values with formatting.
* `Paste` - You can paste only the values without formatting.
Expand All @@ -52,13 +56,15 @@ It also performs for external clipboard operation. If you perform cut and paste,

**User Interface**:

Paste can be done in one of the following ways.
Paste can be performed in one of the following ways:

* Select the destination range, then click the **Paste** button in the Ribbon’s HOME tab.
* Select the destination range, then choose **Paste** from the Context Menu.
* Select the destination range, then press `Ctrl + V` (Windows) or `Command + V` (Mac).

* Using Paste button in the Ribbon’s HOME tab to perform paste operation.
* Using Paste option in the Context Menu.
* Using `Ctrl + V` | `Command + V` keyboard shortcut.
**Programmatically**:

* Using the [`paste`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/#paste) method.
* Using the [`paste`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet#paste) method.

> If you use the Keyboard shortcut key for cut (`Ctrl + X`) | copy (`Ctrl + C`) from other sources, you should use `Ctrl + V` shortcut while pasting into the spreadsheet.
Expand All @@ -75,7 +81,7 @@ Paste can be done in one of the following ways.

## Prevent the paste functionality

The following example shows, how to prevent the paste action in spreadsheet. In [`actionBegin`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet/#actionbegin) event, you can set `cancel` argument as false in paste request type.
The following example shows how to prevent the paste action in the Spreadsheet. In the [`actionBegin`](https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet#actionbegin) event, you can cancel the action by setting the `cancel` argument to `true` when the `requestType` is `paste` and the action is `clipboard`.


{% tabs %}
Expand All @@ -91,7 +97,7 @@ The following example shows, how to prevent the paste action in spreadsheet. In

## Limitations

* External clipboard is not fully supported while copying data from another source and pasting into a spreadsheet, it only works with basic supports (Values, Number, cell, and Text formatting).
* If you copy =SUM(A2,B2) and paste, the formula reference will change depending on the pasted cell address but we don't have support for nested formula(formula reference will be same).
* Clipboard is not supported with conditional formatting (values only pasting).
* We have limitation while copying the whole sheet data and pasting it into another sheet.
* The external clipboard is not fully supported when copying data from another source and pasting into the Spreadsheet; only basic operations are supported (Values, Number formatting, cell formatting, and Text formatting).
* When you copy a formula such as `=SUM(A2,B2)` and paste it, the formula reference is updated based on the destination cell address. Nested formula references are not supported and will not be adjusted on paste.
* Clipboard operations are not supported with conditional formatting; only values are pasted.
* There is a limitation when copying the whole sheet data and pasting it into another sheet.
63 changes: 37 additions & 26 deletions Document-Processing/Excel/Spreadsheet/Javascript-ES5/comment.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ documentation: ug
# Comment in EJ2 JavaScript Spreadsheet control
The **Comment** feature allows you to add feedback to cells without changing their values, enabling contextual discussions through threaded **replies**. Unlike [Notes](./notes), Comment include advanced review tools such as **resolve** and **reopen** to track status, plus an optional **Comments Review Pane** for browsing and managing threads.

Cells with comment display a small comment indicator; hover to preview the comment editor. This provides a clear, collaborative workflow while keeping data intact.
Cells with a comment display a small comment indicator; hover to preview the comment editor. This provides a clear, collaborative workflow while keeping data intact.

![Spreadsheet showing a comment](./images/spreadsheet_comment.png)

Expand All @@ -29,24 +29,35 @@ The Syncfusion Spreadsheet does not automatically track user identity. To tag ne
>If the author property is not set, "Guest User" will be displayed as the author for comment and replies by default.

## Adding a comment
You can add a **comment** to a cell in several ways:
* **Context menu**: Right-click the target cell and select **"New Comment"**.
* **Ribbon**: Go to **Review > Comment > New Comment**.
* **Keyboard shortcut**: Press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F2</kbd> to open the comment editor for the active cell.
* **Programmatically**:
* Use the `updateCell` method with the comment model to add a comment to a specific cell.
* Bind comments via code-behind during initial load by associating the comment model with the cell model.
You can add a **comment** to a cell in several ways.

**UI**

1. Select the target cell.
2. Open the comment editor using one of the following methods:
* **Context Menu**: Right-click the target cell and select **"New Comment"**.
* **Ribbon**: Go to **Review > Comment > New Comment**.
* **Keyboard Shortcut**: Press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F2</kbd>.
3. Type the comment text in the editor and click **Post** to add the comment.

**Programmatically**

You can also add a comment to a cell from code:

* Use the `updateCell` method with the comment model to add a comment to a specific cell. The Spreadsheet instance must be available in scope.
* Bind comments via cell data during initial load by associating the comment model with the cell model.

The image below shows that once a comment is posted, the cell displays an indicator, and the comment can be previewed on hover.

![Adding a comment in Spreadsheet](./images/spreadsheet_adding_a_comment.gif)

## Adding a reply
You can add one or more replies to an existing comment to provide additional details or answers:
* **Context menu**: Right-click the cell that already has a comment, select **Comment > New Reply**, enter your reply, and click **Post**.
You can add one or more replies to an existing comment to provide additional details or answers. Before you begin, select the cell that already contains a comment (the cell shows a comment indicator in its corner).

* **Context Menu**: Right-click the cell that already has a comment, select **Comment > New Reply**, enter your reply, and click **Post**.
* **Ribbon**: Go to **Review > Comment > New Comment** on a cell that contains a comment. This opens the comment editor in **reply mode**.
* **Comment editor**: Open the comment editor by hovering over the comment indicator, type your reply, and click **Post**.
* **Keyboard shortcut**: Press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F2</kbd> on a cell that contains a comment to open the comment editor in reply mode.
* **Comment Editor**: Open the comment editor by hovering over the comment indicator, type your reply, and click **Post**.
* **Keyboard Shortcut**: Press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F2</kbd> on a cell that contains a comment to open the comment editor in reply mode.

After posting, the replies appear under the first comment in the comment editor.

Expand All @@ -55,8 +66,8 @@ After posting, the replies appear under the first comment in the comment editor.
## Editing a comment
You can edit the content of a comment or its replies directly within the comment editor.

* **Edit first comment**: In the comment editor. Click the **"⋯" (More thread actions)** menu in the header, select the **Edit Comment**, modify the text and click **Post**.
* **Edit a reply comment**: In the comment editor, hover over the specific reply, click the **"⋯" (More actions)**, select the **Edit Comment**, modify the text and click **Post**.
* **Edit first comment**: In the comment editor, click the **"⋯" (More thread actions)** menu in the header, select the **Edit Comment**, modify the text and click **Post**.
* **Edit a reply comment**: In the comment editor, hover over the specific reply, click the **"⋯" (More actions)** menu, select the **Edit Comment**, modify the text and click **Post**.

![Editing a comment reply in Spreadsheet](./images/spreadsheet_edit_comment.png)

Expand All @@ -79,7 +90,7 @@ You can also use the `isResolved` property in the comment model when initializin
// Update a cell with a comment using the updateCell method
spreadsheet.updateCell({
comment: {
author: 'Chistoper', text: 'Are you completed the report',
author: 'Christopher', text: 'Are you completed the report',
createdTime: 'January 03, 2026 at 5:00 PM',
// Set to true to mark the thread as resolved; false keeps it active
isResolved: false,
Expand All @@ -94,16 +105,16 @@ You can also use the `isResolved` property in the comment model when initializin
You can delete either a specific reply or an entire comment thread (including all replies) using the following options:

### Deleting a comment thread
* **Context menu**: Right-click the cell that contains the comment and select **Comment > Delete Comment**.
* **Context Menu**: Right-click the cell that contains the comment and select **Comment > Delete Comment**.
* **Ribbon**: Go to **Review > Comment > Delete Comment** on a cell that contains the comment.
* **Comment editor**: In the comment editor, click the **"⋯" (More thread actions)** menu in the header and select **Delete Thread** for an active comment or use the **Delete Thread** button in header for a resolved comment.
* **Comment Editor**: In the comment editor, click the **"⋯" (More thread actions)** menu in the header and select **Delete Thread** for an active comment or use the **Delete Thread** button in the header for a resolved comment.

Deleting a thread removes the comment and all its replies from the cell.

![Deleting a comment thread in Spreadsheet](./images/spreadsheet_delete_comment.png)

### Delete a reply
In the comment editor, hover over the reply and click the **"⋯" (More actions)** menu then select **Delete Comment**.
In the comment editor, hover over the reply and click the **"⋯" (More actions)** menu, then select **Delete Comment**.

![Deleting a comment reply in Spreadsheet](./images/spreadsheet_delete-reply_comment.png)

Expand All @@ -122,8 +133,8 @@ The **"Comments" review pane** provides a centralized view of all comments in th

You can show or hide the "Comments" review pane using:

* **Ribbon**: Go to **Review > Comment > Show Comments**.
* **Property**: Set the `showCommentsPane` property to true when initializing the Spreadsheet. By default, this property is **false**.
* **Ribbon**: Go to **Review > Comment > Show Comments**. Click the same command again to hide the pane.
* **Property**: Set the `showCommentsPane` property to true when initializing the Spreadsheet to show the pane on load. By default, this property is **false**.

![Show comments in Spreadsheet](./images/spreadsheet_show_comments.gif)

Expand All @@ -132,7 +143,7 @@ The "Comments" review pane is rendered within the spreadsheet interface to provi

The "Comments" review pane allows you to:

* Add new comment using the **New** button.
* Add a new comment using the **New** button.
* Filter comments by **All**, **Active**, or **Resolved** to view specific comment threads.
* Navigate between comments and synchronize selection with the corresponding cells.
* Perform actions such as:
Expand All @@ -141,11 +152,11 @@ The "Comments" review pane allows you to:
* **Delete** – Remove a reply or an entire thread.
* **Resolve/Reopen** – Change the status of a comment.

When the review pane is open, all actions performed in the review pane or in the cell’s comment editor are synchronized:
When the review pane is open, actions performed in the review pane or in the cell’s comment editor are synchronized in most cases:

* Selecting a comment in the review pane highlights the corresponding cell in the sheet.
* Selecting a cell with a comment focuses the respective comment thread in the review pane.
* Actions such as **Reply**, **Edit**, **Delete**, and **Resolve/Reopen** update both the pane and the cell comment editor instantly, ensuring consistency across the UI.
* Actions such as **Reply**, **Edit**, **Delete**, and **Resolve/Reopen** generally update both the pane and the cell comment editor, ensuring consistency across the UI.
* The review pane dynamically updates when comments are added, deleted, or resolved, so you always see the latest state without refreshing.

## Saving a Workbook with Comments
Expand All @@ -160,8 +171,8 @@ Threaded comments introduced in newer Excel versions require the **Open XML** st

> To retain threaded comments, always save the workbook in **.xlsx** format.

## Bind Comments via code-behind
You can bind **comment thread** to cells at initial load by providing a `comment` object in the cell model. Each cell supports **per comment thread**, which can include:
## Bind Comments via cell data
You can bind **comment thread** to cells at initial load by providing a `comment` object in the cell model. Each cell supports a single comment thread, which can include:
- **Comment**: `author`, `text`, `createdTime`, `isResolved`
- **Replies**: A collection of replies. Each reply is an object containing its `author`, `text`, and `createdTime` (no nested replies-of-replies).

Expand All @@ -185,7 +196,7 @@ In the below sample, comments are added to a specific cell using cell data bindi

## Limitations
* **Un-posted comments are not stored**: If you type in the comment editor and close it without clicking **Post**, the entered text is not saved and will not appear when you reopen the editor. Only posted content is persisted in the comment model.
* **Comments and Notes cannot coexist**: When a cell contains comment, notes cannot be added. Similarly, if a cell already has a notes, comment cannot be added.
* **Comments and Notes cannot coexist**: When a cell contains a comment, notes cannot be added. Similarly, if a cell already has a note, a comment cannot be added.
* **Comments in Print**: Comments are not included in print output.
* **Non-collaborative**: Real-time multi-user synchronization is not supported. However, when exporting and re-importing the workbook, the author information for each comment and reply is preserved.

Expand Down
Loading