Skip to content

Commit c3a6ede

Browse files
996221: Added UG content for the threaded comment feature.
1 parent 620a699 commit c3a6ede

File tree

11 files changed

+555
-0
lines changed

11 files changed

+555
-0
lines changed

Document-Processing-toc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5046,6 +5046,7 @@
50465046
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/filter">Filtering</a></li>
50475047
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/sort">Sorting</a></li>
50485048
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/link">Hyperlink</a></li>
5049+
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/comment">Comment</a></li>
50495050
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/notes">Notes</a></li>
50505051
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/clipboard">Clipboard</a></li>
50515052
<li><a href="/document-processing/excel/spreadsheet/javascript-es6/selection">Selection</a></li>
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
---
2+
layout: post
3+
title: Comment in EJ2 TypeScript Spreadsheet control | Syncfusion
4+
description: Learn here all about Comment feature in Syncfusion EJ2 TypeScript Spreadsheet control of Syncfusion Essential JS 2 and more.
5+
platform: document-processing
6+
control: Comment
7+
documentation: ug
8+
---
9+
10+
# Comment in EJ2 TypeScript Spreadsheet control
11+
12+
The **Comment** feature allows you to add remarks and **replies** to cells, making it easier to provide feedback or enabling contextual discussions without altering cell values. Comment are distinct from **Notes** and includes advanced capabilities such as replies, resolve/reopen, and an optional **Comments Review Pane** to maintain clear communication and streamline review workflows. When a cell contains a comment, a small comment indicator appears in its corner. Hover over the indicator to preview the comment.
13+
14+
![Spreadsheet showing a comment](./images/spreadsheet_show_comment.png)
15+
16+
## Author identity
17+
18+
The Syncfusion Spreadsheet does not automatically track user identity. To tag new comments and replies with an author name, set the `author` property when initializing the Spreadsheet.
19+
20+
```ts
21+
22+
import { Spreadsheet } from '@syncfusion/ej2-spreadsheet';
23+
// Initialize Spreadsheet component
24+
const spreadsheet: Spreadsheet = new Spreadsheet(
25+
// Assign the author property
26+
author: 'Place the Author Name Here'
27+
);
28+
// Render initialized Spreadsheet
29+
spreadsheet.appendTo('#element');
30+
31+
```
32+
If the author property is not set, comments and replies will display Guest User as the author by default.
33+
34+
The host application is responsible for setting the current user's display name for each session.
35+
36+
## Adding a comment
37+
38+
You can add a **comment** to a cell in the following ways:
39+
* **Context menu**: Right-click the target cell and click **"New Comment"**.
40+
* **Ribbon**: Use **Review > Comment > New Comment**.
41+
* **Keyboard shortcut**: Press **Ctrl + Shift + F2** to open the comment container.
42+
* **Programmatically**: Use the `updateCell` method to assign a comment to a specific cell.
43+
44+
**Example for using `updateCell` method with comment:**
45+
46+
```ts
47+
48+
// Create a comment in the desired cell
49+
spreadsheet.updateCell({
50+
comment: {
51+
author: 'Chistoper', text: 'Are you completed the report',
52+
createdTime: 'January 03, 2026 at 5:00 PM',
53+
isResolved: false,
54+
replies: [{ author: 'John', text: 'Yes, completed',
55+
createdTime: 'January 03, 2026 at 7:00 PM' }]
56+
}
57+
}, 'Sheet1!D5');
58+
59+
```
60+
![Adding a comment in Spreadsheet](./images/spreadsheet_show_comment.png)
61+
62+
After posting, the comment becomes visible with the comment indicator in the cell and can be previewed on hover.
63+
64+
## Adding a reply
65+
66+
You can add one or more replies to an existing comment to provide additional details or answers:
67+
68+
* **Hover over the comment indicator** on the cell to open the comment container, type your reply in the input box, and click **Post**.
69+
* **Context menu**: Right-click the cell, select **Comment > New Reply**, enter your reply, and click **Post**.
70+
* **Ribbon**: Use **Review > Comment > New Comment** on a cell that already has a comment. This triggers **reply mode**.
71+
* **Keyboard shortcut**: Press **Ctrl + Shift + F2** on a cell that contains a comment to open the comment container in reply mode.
72+
73+
![Adding a reply in comment](./images/spreadsheet_show_comment.png)
74+
75+
After posting, the replies appear under the initial comment in the container.
76+
77+
## Editing a comment or reply
78+
79+
You can edit the content of a comment or its replies directly within the container
80+
81+
* **Initial comment**: Hover over the cell indicator to open the comment container. Click the **⋯ (More thread actions)** menu in the header, select **Edit Comment**, modify the text, and click **Post**.
82+
* **Reply**: Hover over the specific reply, click the **⋯ (More actions)**, select **Edit Comment**, update the text, and click **Post**.
83+
84+
![Editing a comment or reply in Spreadsheet](./images/spreadsheet_show_comment.png)
85+
86+
## Deleting a reply
87+
88+
You can remove a specific reply from a comment:
89+
90+
* Hover over the reply inside the comment container, click **⋯ (More actions)** and select **Delete Comment**.
91+
92+
![Deleting reply in Spreadsheet](./images/spreadsheet_show_comment.png)
93+
94+
## Resolve and Reopen
95+
96+
The **Resolve** option marks a comment as completed when the discussion or issue is addressed. When a thread is resolved, its background color changes to indicate the resolved state, and the reply input box and reply menu actions are hidden. Use **Reopen** to restore the comment if further discussion is needed.
97+
98+
### Resolve a comment
99+
* Hover over the cell indicator to open the comment container and click **⋯ (More thread actions)** menu in the container header and select **Resolve Thread**.
100+
101+
### Reopen a comment
102+
* Hover over the cell indicator to open the comment container and click **Reopen** button in the header to make the thread active again.
103+
104+
![Resolve and reopen in Spreadsheet](./images/spreadsheet_show_comment.png)
105+
106+
You can also use the `isResolved` property in the comment model when initializing or updating comments programmatically.
107+
108+
## Deleting a comment
109+
110+
You can delete an entire comment thread
111+
(including all replies) using any of the following methods:
112+
113+
* **Context menu**: Right-click the cell that contains the comment and select **Comment > Delete Comment**.
114+
* **Ribbon**: Use **Review > Comment > Delete Comment** on a cell that contains the comment.
115+
* **Comment container**: Hover over the cell indicator to open the comment container, click **⋯ (More thread actions)** menu in the container header and select **Delete Thread** for active comment or use the **Delete Thread** button in container header for the resolved comment.
116+
117+
![Deleting comment in Spreadsheet](./images/spreadsheet_show_comment.png)
118+
119+
Deleting a thread removes the comment and all its replies from the cell.
120+
121+
## Next and Previous Comment
122+
123+
The **Review > Comment > Next Comment and Previous Comment** options in the ribbon allow you to quickly navigate between cells that contain comments:
124+
125+
* **Next Comment**: Moves to the next cell with a comment.
126+
* **Previous Comment**: Moves to the previous cell with a comment.
127+
128+
![Next and Previous comment in Spreadsheet](./images/spreadsheet_show_comment.png)
129+
130+
Navigation starts within the active sheet. When all comments in the active sheet have been visited (end or start reached), the navigation automatically continues to the next or previous sheet that contains comments. This ensures you can review all comments across the workbook without manually switching sheets.
131+
132+
## Show Comments and Comments Review Pane
133+
134+
The **Comments Review Pane** provides a centralized view of all comments in the active sheet and offers filtering, inline actions, and navigation. This pane helps you manage comments efficiently without switching between individual cells.
135+
136+
You can show or hide the Comments Review Pane using:
137+
138+
* **Ribbon**: Use **Review > Comment > Show Comments**.
139+
* **Property**: Set the [`showCommentsPane`](https://ej2.syncfusion.com/documentation/api/spreadsheet/#showCommentsPane) property when initializing the Spreadsheet.
140+
141+
> The default value for the `showCommentsPane` property is `false`.
142+
143+
![Show comments in Spreadsheet](./images/spreadsheet_show_comment.png)
144+
145+
### Features of the Comments Review Pane
146+
147+
The Comments Review Pane allows you to:
148+
149+
* **Add new comment** using the **New** button.
150+
* **Filter comments** by **All**, **Active**, or **Resolved** to focus on specific comments.
151+
* **Navigate between comments** and synchronize selection with the corresponding cells.
152+
* Perform actions such as:
153+
* **Reply** – Add replies directly from the pane.
154+
* **Edit** – Modify the text of a comment or reply.
155+
* **Delete** – Remove a reply or an entire thread.
156+
* **Resolve/Reopen** – Change the status of a comment.
157+
158+
When the Review Pane is open, all actions performed in the pane or in the cell’s comment container are synchronized:
159+
160+
* Selecting a comment in the Review Pane highlights the corresponding cell in the sheet.
161+
* Selecting a cell with a comment focuses the related comment in the Comment Review Pane.
162+
* Actions such as **Reply**, **Edit**, **Delete**, and **Resolve/Reopen** update both the pane comment container and the cell comment container instantly, ensuring consistency across the UI.
163+
164+
## Saving a Workbook with Comments
165+
166+
You can save spreadsheet data along with **comments** using **File > Save As > Microsoft Excel(.xlsx)**.
167+
- **MS Excel (.xlsx)** - Preserves all **threaded comments** (modern comments).
168+
169+
> Comments are **not included** when exporting to **.xls**, **.csv**, and **.pdf**.
170+
171+
### Why Comments Are Not Saved in `.xls`
172+
The **.xls** format is based on the older Excel binary structure (BIFF8), which does not support modern features like **threaded comments**.
173+
Threaded comments introduced in newer Excel versions require the **Open XML** structure used by `.xlsx`.
174+
175+
>To retain threaded comments, always save the workbook in **.xlsx** format.
176+
177+
## Integrating comments during initial loading using cell data binding
178+
179+
You can bind **comments** to cells at initial load by providing a `comment` object in the cell model. Each cell supports **per comment thread**, which can include:
180+
- **Initial comment fields**: `author`, `text`, `createdTime`, `isResolved`
181+
- **Replies**: A **flat array** of `{ author, text, createdTime }` objects (no nested replies-of-replies)
182+
183+
When the workbook renders, cells that include a `comment`:
184+
- Show the **comment indicator** in the cell corner.
185+
- Open the **comment container** on hover.
186+
- Appear in the **Comments Review Pane** if it is shown.
187+
188+
189+
In the below example, comments are added to specific cells via cell data binding. The review pane is shown initially, and comments are added using `updateCell` method in the `created` event.
190+
191+
{% tabs %}
192+
{% highlight ts tabtitle="index.ts" %}
193+
{% include code-snippet/spreadsheet/javascript-es6/comemnt-cs1/index.ts %}
194+
{% endhighlight %}
195+
{% highlight html tabtitle="index.html" %}
196+
{% include code-snippet/spreadsheet/javascript-es6/comemnt-cs1/index.html %}
197+
{% endhighlight %}
198+
{% endtabs %}
199+
200+
{% previewsample "/document-processing/code-snippet/spreadsheet/javascript-es6/comemnt-cs1" %}
201+
202+
### Notes
203+
204+
* **One thread per cell**: Attach a single `comment` object per cell. New remarks should be added as replies inside the existing thread.
205+
* **Resolved**: Use `isResolved: true` to render a thread in resolved state.
206+
* **Indicator & preview**: Cells with comments show an indicator; hover opens the comment container for preview and inline actions.
207+
* **Comments Review pane**: Set `showCommentsPane: true` to manage threads centrally (add, filter, navigate, reply, edit, delete, resolve/reopen).
208+
209+
## Limitations
210+
211+
* **Unposted comment is not stored**: If you type in the comment container and close it without clicking **Post**, the entered text is not saved. Only posted content is persisted in the comment model.
212+
* **Export support**: Threaded comments are not exported to **.xls**, **.csv**, and **.pdf**.
213+
* **Single thread per cell**: Only one comment thread is supported per cell; replies are a flat list (no nested reply-to-reply).
214+
* **Non-collaborative**: Real-time multi-user sync is not supported; the host app must set the author identity for the session.
99.5 KB
Loading

Document-Processing/Excel/Spreadsheet/Javascript-ES6/keyboard-shortcuts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ The keyboard shortcuts supported in the spreadsheet are,
107107
| Shift + Enter | Complete the cell editing and select the cell above in the same column. |
108108
| Tab | Complete the cell editing and select the next cell in the same row. |
109109
| Shift + Tab | Complete the cell editing and select the previous cell in the same row. |
110+
| Ctrl + Shift + F2 | Open the threaded comment container for the desired cells. Upon pressing the `Esc` key, the comment container in focus will close. |
110111
| Shift + F2 | Open the dialog box to add or edit notes for the desired cells. Meanwhile, upon pressing the `Esc` key, the dialog box for notes, when in focus, will save and close. |
111112
| Alt | Focus on the active ribbon tab. |
112113
| Left | Move the focus to the previous items in the ribbon content. |
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Comment Shipment details data source
3+
*/
4+
export let shipmentData: Object[] = [
5+
{ 'Order ID': 10248, 'Customer Name': 'Paul Henriot', 'Address': '59 rue de l Abbaye', 'Country': 'France', 'Status': 'Delivered' },
6+
{ 'Order ID': 10249, 'Customer Name': 'Karin Josephs', 'Address': 'Luisenstr. 48', 'Country': 'Germany', 'Status': 'Delivered' },
7+
{ 'Order ID': 10250, 'Customer Name': 'Mario Pontes', 'Address': 'Rua do Paço, 67', 'Country': 'Brazil', 'Status': 'Shipped' },
8+
{ 'Order ID': 10251, 'Customer Name': 'Mary Saveley', 'Address': '2, rue du Commerce', 'Country': 'France', 'Status': 'Delivered' },
9+
{ 'Order ID': 10252, 'Customer Name': 'Pascale Cartrain', 'Address': 'Boulevard Tirou, 255', 'Country': 'Belgium', 'Status': 'Shipped' },
10+
{ 'Order ID': 10253, 'Customer Name': 'Carlos Hernández', 'Address': 'Rua do Paço, 67', 'Country': 'Brazil', 'Status': 'Cancelled' },
11+
{ 'Order ID': 10254, 'Customer Name': 'Yang Wang', 'Address': 'Hauptstr. 31', 'Country': 'Switzerland', 'Status': 'Pending' },
12+
{ 'Order ID': 10255, 'Customer Name': 'Antonio Moreno', 'Address': 'Starenweg 5', 'Country': 'Switzerland', 'Status': 'Delivered' },
13+
{ 'Order ID': 10256, 'Customer Name': 'Paula Parente', 'Address': 'Rua do Mercado, 12', 'Country': 'Brazil', 'Status': 'Shipped' },
14+
{ 'Order ID': 10257, 'Customer Name': 'Michael Holz', 'Address': 'Carrera 22 con Ave.', 'Country': 'Venezuela', 'Status': 'Delivered' },
15+
{ 'Order ID': 10258, 'Customer Name': 'Roland Mendel', 'Address': 'Kirchgasse 6', 'Country': 'Austria', 'Status': 'Cancelled' }
16+
];
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Comment Shipment details data source
3+
*/
4+
var shipmentData = [
5+
{ 'Order ID': 10248, 'Customer Name': 'Paul Henriot', 'Address': '59 rue de l Abbaye', 'Country': 'France', 'Status': 'Delivered' },
6+
{ 'Order ID': 10249, 'Customer Name': 'Karin Josephs', 'Address': 'Luisenstr. 48', 'Country': 'Germany', 'Status': 'Delivered' },
7+
{ 'Order ID': 10250, 'Customer Name': 'Mario Pontes', 'Address': 'Rua do Paço, 67', 'Country': 'Brazil', 'Status': 'Shipped' },
8+
{ 'Order ID': 10251, 'Customer Name': 'Mary Saveley', 'Address': '2, rue du Commerce', 'Country': 'France', 'Status': 'Delivered' },
9+
{ 'Order ID': 10252, 'Customer Name': 'Pascale Cartrain', 'Address': 'Boulevard Tirou, 255', 'Country': 'Belgium', 'Status': 'Shipped' },
10+
{ 'Order ID': 10253, 'Customer Name': 'Carlos Hernández', 'Address': 'Rua do Paço, 67', 'Country': 'Brazil', 'Status': 'Cancelled' },
11+
{ 'Order ID': 10254, 'Customer Name': 'Yang Wang', 'Address': 'Hauptstr. 31', 'Country': 'Switzerland', 'Status': 'Pending' },
12+
{ 'Order ID': 10255, 'Customer Name': 'Antonio Moreno', 'Address': 'Starenweg 5', 'Country': 'Switzerland', 'Status': 'Delivered' },
13+
{ 'Order ID': 10256, 'Customer Name': 'Paula Parente', 'Address': 'Rua do Mercado, 12', 'Country': 'Brazil', 'Status': 'Shipped' },
14+
{ 'Order ID': 10257, 'Customer Name': 'Michael Holz', 'Address': 'Carrera 22 con Ave.', 'Country': 'Venezuela', 'Status': 'Delivered' },
15+
{ 'Order ID': 10258, 'Customer Name': 'Roland Mendel', 'Address': 'Kirchgasse 6', 'Country': 'Austria', 'Status': 'Cancelled' }
16+
];
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>EJ2 SpreadSheet Comment Sample</title>
6+
<meta charset="utf-8" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<meta name="description" content="Typescript UI Controls" />
9+
<meta name="author" content="Syncfusion" />
10+
<link rel="shortcut icon" href="resources/favicon.ico" />
11+
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
12+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-base/styles/material.css" rel="stylesheet" />
13+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-inputs/styles/material.css" rel="stylesheet" />
14+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-buttons/styles/material.css" rel="stylesheet" />
15+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
16+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-lists/styles/material.css" rel="stylesheet" />
17+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-navigations/styles/material.css" rel="stylesheet" />
18+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-popups/styles/material.css" rel="stylesheet" />
19+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-dropdowns/styles/material.css" rel="stylesheet" />
20+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-grids/styles/material.css" rel="stylesheet" />
21+
<link href="https://cdn.syncfusion.com/ej2/32.1.1/ej2-spreadsheet/styles/material.css" rel="stylesheet" />
22+
<link href="styles.css" rel="stylesheet" />
23+
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
24+
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/shim.min.js"></script>
25+
<script src="system.config.js"></script>
26+
<script src="es5-datasource.js" type="text/javascript"></script>
27+
</head>
28+
29+
<body>
30+
<!--Element which is going to render-->
31+
<div id='loader'>Loading....</div>
32+
<div id='container'>
33+
<div id="spreadsheet"></div>
34+
</div>
35+
</body>
36+
37+
</html>

0 commit comments

Comments
 (0)