[Solved] Macro Calc to deselect all cells

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
ghizzo74
Posts: 2
Joined: Sun Mar 06, 2016 10:07 am

[Solved] Macro Calc to deselect all cells

Post by ghizzo74 »

Hi!

I've not found a example wich show me how to deselect ALL the selected cells in the current sheet using a Macro.... Can someone help me? ;)

Thanks a lot in advance! :super:
Last edited by ghizzo74 on Sun Mar 06, 2016 1:23 pm, edited 1 time in total.
OpenOffice 4.1.2 on Windows 10 Pro
User avatar
Villeroy
Volunteer
Posts: 31361
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro Calc to deselect all cells

Post by Villeroy »

Code: Select all

dummy = ThisComponent.createInstance("com.sun.star.sheet.SheetCellRanges")
view = ThisComponent.getCurrentController()
view.select(dummy)
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
ghizzo74
Posts: 2
Joined: Sun Mar 06, 2016 10:07 am

Re: [SOLVED] Macro Calc to deselect all cells

Post by ghizzo74 »

Thanks Villeroy!

It works nicely....in the meanwhile i've found an alternative way using the Uno API

Code: Select all


document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:Deselect", "", 0, array())	

OpenOffice 4.1.2 on Windows 10 Pro
Post Reply