Hi everybody.
I want a macro that insert a note in the selected cell.
The operation is the following one:
I select the cell where I want to insert the note
I press a button that starts the macro for inserts the note in the cell selected before
Thank you
[Solved] Create a note
[Solved] Create a note
Last edited by Hagar Delest on Wed Jun 25, 2008 5:42 pm, edited 1 time in total.
Reason: tagged the thread as Solved.
Reason: tagged the thread as Solved.
OOo 2.3.X on openSuse 10
Re: create a note
Install The Xray Tool. You can not live without it.
Code: Select all
Sub Main
oDoc = thisComponent
oSheet = oDoc.Sheets.getByIndex(0)
oCell = oSheet.getCellByPosition(0, 0)
GlobalScope.BasicLibraries.loadLibrary("XrayTool")
xray oCell
oNote = oCell.getAnnotation() 'or pseudo-property .Annotation
xray oNote
oNote.setString("Hello, Note") 'or pseudo-property .String
End Sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: create a note
You are amazing!!
But if i don't know where i want insert a note before.
I want select a cell whit mouse and insert a note in this cell i cant use oCell = oSheet.getCellByPosition(0, 0) because i don't know the cell
But if i don't know where i want insert a note before.
I want select a cell whit mouse and insert a note in this cell i cant use oCell = oSheet.getCellByPosition(0, 0) because i don't know the cell
OOo 2.3.X on openSuse 10
- Hagar Delest
- Moderator
- Posts: 32661
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: create a note
See here: [Solved] Set variable to value of =COLUMN().
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Re: create a note
Follow the link provided by Hagar de l'Est. A selection in Calc is always one of:I want a macro that insert a note in the selected cell.
1. a multiple selection of ranges by service "com.sun.star.sheet.SheetCellRanges"
2. some shape (annotation, chart, drawing, ...)
3a. a single range of service "com.sun.star.sheet.SheetCellRange"
3b. which is a single cell if it additionally supports "com.sun.star.sheet.SheetCell" (highlighted or not)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: create a note
which might be exactly what you do *not* really want, unless the current selection happens to be a single cell. Use function getActiveCell from the other thread, which always returns the current input cell even if a shape is selected.briglia23 wrote:i got it.
i used getCurrentSelection()
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice