Method Add
- Namespace
- DocWright.Spreadsheet
- Assembly
- DocWright.Spreadsheet.dll
Add(int, int, string, string?)
Adds a note to a cell, as Excel's New Note does.
public XlsxComment Add(int row, int column, string text, string? author = null)
Parameters
rowintThe one-based row.
columnintThe one-based column.
textstringThe note's text; a line break is
\n.authorstringThe author, as Excel records the user's name; null for none (an empty name).
Returns
- XlsxComment
The note.
Exceptions
- ArgumentNullException
textis null.- ArgumentException
The text or the author is longer than 32,767 characters or holds a character a workbook cannot store.
- ArgumentOutOfRangeException
The cell is outside the worksheet grid.
- InvalidOperationException
The cell has a note or a threaded comment already (Excel allows one), or the sheet is not a worksheet.
- InvalidDocumentException
A part of the workbook is malformed.
Add(string, string, string?)
Adds a note to a cell, as Excel's New Note does. See Add(int, int, string, string?).
public XlsxComment Add(string reference, string text, string? author = null)
Parameters
referencestringThe cell, such as
B2.textstringThe note's text.
authorstringThe author; null for none.
Returns
- XlsxComment
The note.
Exceptions
- ArgumentException
The reference is not a cell, or the text or the author cannot be written.
- ArgumentNullException
textis null.- InvalidOperationException
The cell has a note or a threaded comment already, or the sheet is not a worksheet.
- InvalidDocumentException
A part of the workbook is malformed.