sheetjs/docbits/66_comments.md
SheetJS 64798fd1f9 version bump 0.13.0: AMD support
- library reshaped to support requirejs / amd without shim
- control comment visibility (fixes #998, h/t @cmuruganmsc)
- fixed README code sample error (fixes #1118 h/t @iahmedani)
2018-06-01 12:32:08 -04:00

887 B

Cell Comments

Cell comments are objects stored in the c array of cell objects. The actual contents of the comment are split into blocks based on the comment author. The a field of each comment object is the author of the comment and the t field is the plain text representation.

For example, the following snippet appends a cell comment into cell A1:

if(!ws.A1.c) ws.A1.c = [];
ws.A1.c.push({a:"SheetJS", t:"I'm a little comment, short and stout!"});

Note: XLSB enforces a 54 character limit on the Author name. Names longer than 54 characters may cause issues with other formats.

To mark a comment as normally hidden, set the hidden property:

if(!ws.A1.c) ws.A1.c = [];
ws.A1.c.push({a:"SheetJS", t:"This comment is visible"});

if(!ws.A2.c) ws.A2.c = [];
ws.A2.c.hidden = true;
ws.A2.c.push({a:"SheetJS", t:"This comment will be hidden"});