Reputation: 559
I am writing a Basic macro in NeoOffice (a mac OO clone) and I want to highlight/select the cell in the table the cursor is in at the time the macro runs.
Google gave me the following related snipset, and it does color the cell, but I want to select/highlight it instead as you would with the mouse. I feel I'm on the right track...
Sub selectCell
Dim the_Cursor As Object
Dim the_CurCell As Object
the_CurCell=thisComponent.currentSelection(0).cell
the_Cursor=the_CurCell.CreateTextCursorByRange(the_CurCell.start)
the_Cursor.GoRight(1, true) 'le curseur recouvre toute la cellule
the_Cursor.GoLeft(1, true) 'le curseur recouvre toute la cellule
'the_CurCell.setPropertyValue("BackColor", 16711935) ' Magenta clair / Light Magenta
End Sub
Any ideas?
PS:I am running NeoOffice v3.3 which should be based on the same version of OO.
Upvotes: 0
Views: 2317
Reputation: 1075
copied answer from
https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=77377
Sub select_Cell_Texttable
oTexttables = thiscomponent.texttables
oTable1 = oTexttables.getByName("Table1")
ocell = oTable1.getcellbyPosition(0,0)
'ocell = oTable1.getcellbyName("A1")
oViewCursor = ThisComponent.CurrentController.ViewCursor
oViewCursor.gotoRange(ocell,false)
oViewCursor.goright(1,true)
oViewCursor.goleft(1,true)
end sub
Upvotes: 0