Table of Contents

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

row int

The one-based row.

column int

The one-based column.

text string

The note's text; a line break is \n.

author string

The author, as Excel records the user's name; null for none (an empty name).

Returns

XlsxComment

The note.

Exceptions

ArgumentNullException

text is 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

reference string

The cell, such as B2.

text string

The note's text.

author string

The 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

text is 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.