Page 1 of 1
Select shape by name
Posted: Tue Dec 16, 2014 4:58 am
by ze_luis
Hello, I'm trying to learn a bit of OObasic.
So far, I didn't find anything, even in this forum.
Does anyone have a clue how to select one shape by name in calc?
Thanks for any help.
Re: macro to select shape by name
Posted: Tue Dec 16, 2014 5:08 am
by FJCC
The Drawpage of a Calc sheet doesn't have a getByName() method. You could try iterating over all the objects and testing the name, though I don't know that all possible objects will have a Name property.
Code: Select all
oSheet = ThisComponent.Sheets.getByName("Hoja1")
oDP = oSheet.Drawpage
count = oDP.Count
For i = 0 to count - 1
oItem = oDP.getByIndex(i)
If oItem.Name = "TheShape" then
print "Found it!"
end If
next i
Re: macro to select shape by name
Posted: Tue Dec 16, 2014 6:05 pm
by ze_luis
Thanks for assistance.
I already did exactly the code you wrote.
As I have lots of shapes, the program became slow until find the shape and make the necessary changes.
My hope was selecting the shape in a very direct way.
Anyhow thanks again for your response.