Hello,
I have a problem which I don’t know if it’s a bug or if I just made some error in the code.
Function AddAnnotation(annotation as String, s as integer, r as integer, c as integer)
Sheets = ThisComponent.Sheets
Sheet = Sheets.getByIndex(s-1)
Annotations = Sheet.getAnnotations()
Cell = Sheet.getCellByPosition(c, r)
CellAddr = Cell.CellAddress
Annotations.insertNew(CellAddr, annotation)
Cell.Annotation.isVisible = True
End Function
This macro add an annotation to a cell specified by s, r and c. It work perfectly fine if the targeted cell is on another sheet than the one where the macro was called from but if you call it to the same one then it doesn’t do anything.
For example: If I call =AddAnnotation("TEST"; 2; 1; 1)
from a cell on the first sheet it’ll work and add an annotation to the second sheet cell “B2” but if i call the same code from a cell on the second sheet it won’t work.
I’m on Windows 7 and this problem exist at least on OpenOffice 4.1.2 and LibreOffice 5.1.0.3
Any suggestions?