Make visible cell selection in Writer with Basic Macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
jorn
Posts: 1
Joined: Wed May 27, 2015 8:53 pm

Make visible cell selection in Writer with Basic Macro

Post by jorn »

Hi,

I am writing a macro to perform some operations on a cell in a table. Before I do anything, I want to visibly show the user which cell is being operated on. So I want to visibly highlight/select the cell the cursor is currently at, not just the text.

Image

Is that possible? I have been looking at some code using cursors and while I can change the text properties such as colors, I cannot make the cell appear selected.

Any ideas.

Thanks.
NeoOffice 3.3 with OSX 10.6.8
User avatar
Zizi64
Volunteer
Posts: 11486
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Make visible cell selection in Writer with Basic Macro

Post by Zizi64 »

Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
F3K Total
Volunteer
Posts: 1044
Joined: Fri Dec 16, 2011 8:20 pm

Re: Make visible cell selection in Writer with Basic Macro

Post by F3K Total »

Hi,
try this

Code: Select all

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
@Zizi64 : seems to be a Writer-Texttable?
R
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 11 AOO, LO | Linux Mint AOO, LO
User avatar
Zizi64
Volunteer
Posts: 11486
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Make visible cell selection in Writer with Basic Macro

Post by Zizi64 »

@Zizi64 : seems to be a Writer-Texttable?
R
Oh sorry, I was careless: the linked example is for Calc table...
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply