Cell Comments
Since v1.4.0 you can attach a comment (a classic Excel “memo/note”) to any cell. Each commented cell shows a red corner marker and reveals a bubble on hover. Comments are single-author notes — threaded replies are intentionally out of scope.
Note: Authoring comments is a Pro feature. Reading comments (
getComment,getComments,hasComment) works in Lite, so comments authored in Pro — or read from xlsx — still surface in the free tier.
Setting a comment
There is one comment per cell. Set it by row/column on the worksheet, or through a cell handle:
import { createReogrid } from '@reogrid/pro'
const grid = createReogrid({ workspace: '#app' })
const ws = grid.worksheet
// By row/column — returns the comment's numeric id
ws.setComment(0, 2, 'Tax-exclusive unit price.', { author: 'Accounting' })
// Via a cell handle
ws.cell('B2').setComment('Bulk discount applies above 4 packs.', { author: 'QA' })
Calling setComment again on the same cell replaces the existing note.
SetCommentOptions
| Option | Type | Description |
|---|---|---|
author | string | Author name (also written to xlsx <authors>). |
visible | boolean | Pin the comment box visible (preserved for round-trip; v1 always shows the marker + hover bubble). |
Reading comments (Lite-readable)
ws.getComment(0, 2) // CellComment | null
ws.hasComment(0, 2) // boolean
ws.getComments() // readonly CellComment[] on the sheet
ws.cell('B2').getComment()
A CellComment is { id, row, col, text, author?, visible? }.
Updating and removing
ws.setCommentVisible(0, 2, true) // toggle the pinned-visible flag
ws.removeComment(0, 2) // remove one comment (returns true if removed)
ws.clearComments() // remove every comment on the sheet
Display
Every commented cell renders a small red triangle in the top-right corner; hovering the cell shows the comment text in a bubble. The visible flag is preserved through I/O for a future always-visible box, but v1 always uses the marker-plus-hover behavior.
Persistence: xlsx read-only, JSON round-trip
- xlsx: comments are read from
.xlsx(imported files show their notes), but writing comments back to xlsx (VML) is deferred — exporting to xlsx will not include newly authored comments yet. - ReoGrid JSON: comments round-trip fully through ReoGrid JSON, so use JSON when you need to persist comments authored in the app.
Related
- Cell Tooltip — dynamic, hover-driven hints (distinct from stored comments).
- Cell Data — reading and writing the underlying cell values.
- ReoGrid JSON — the format that preserves comments losslessly.