FSheetsNoteRangeMixin
| packages | @univerjs/sheets-note |
|---|
APIs
createOrUpdateNote
Create or update the annotation of the top-left cell in the range
Signature
createOrUpdateNote(note: ISheetNote): FRangeParameters
note(ISheetNote) — The annotation to create or update
Returns
- (
FRange) — This range for method chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getActiveSheet()
const fRange = fWorksheet.getRange('A1')
fRange.createOrUpdateNote({
note: 'This is a note',
width: 160,
height: 100,
show: true,
})deleteNote
Delete the annotation of the top-left cell in the range
Signature
deleteNote(): FRangeReturns
- (
FRange) — This range for method chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getActiveSheet()
const notes = fWorksheet.getNotes()
console.log(notes)
if (notes.length > 0) {
// Delete the first note
const { row, col } = notes[0]
fWorksheet.getRange(row, col).deleteNote()
}getNote
Get the annotation of the top-left cell in the range
Signature
getNote(): Nullable<ISheetNote>Returns
- (
Nullable<ISheetNote>) — The annotation of the top-left cell in the range
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getActiveSheet()
const fRange = fWorksheet.getRange('A1:D10')
const note = fRange.getNote()
console.log(note)