Note

See also Notes for worksheet and workbook note collections. Modern threaded comments use a separate Comment model.

class Note

Represents a cell Note.

Before the introduction of threaded comments, a Note was called a Comment.

示例

import xlwings as xw

book = xw.Book()
cell = book.sheets[0]["A1"]
note = cell.add_note("Review this value")
print(note.text)

在 0.24.2 版本加入.

property api: Any

Returns the native object (pywin32 or appscript obj) of the engine being used.

在 0.24.2 版本加入.

property author: str

The note's author. In xlwings Lite, use await get_author().

在 0.37.5 版本加入.

delete()

Delete the note.

在 0.24.2 版本加入.

async get_author()

Read the note's author from Excel; return None if the note is gone.

Requires xlwings Lite.

在 0.37.5 版本加入.

返回类型:

str | None

async get_location()

Read the note's cell from Excel; return None if it is gone.

Requires xlwings Lite.

在 0.37.5 版本加入.

返回类型:

Range | None

async get_text()

Fetch the note's text on demand.

Requires xlwings Lite.

在 0.37.0 版本加入.

返回类型:

str | None

property location: Range

The cell containing this note. In xlwings Lite, use await get_location().

在 0.37.5 版本加入.

property text: str

Gets or sets the text of a note. Keep in mind that the note must already exist!

示例

>>> sheet = xw.Book(...).sheets[0]
>>> sheet['A1'].note.text = 'mynote'
>>> sheet['A1'].note.text
>>> 'mynote'

在 0.24.2 版本加入.