OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to get list of existing named cell

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
mcharp
General User
General User


Joined: 23 Apr 2005
Posts: 10

PostPosted: Sat Apr 23, 2005 1:38 pm    Post subject: How to get list of existing named cell Reply with quote

Hi,
I try to find some examples that return list of named cells in a Calc spreadsheet.

I tried something like :
oSheet.getNames().getElementNames()
oSheet.getCellNames().getElementNames()
but I couldn't find exact syntax.

I know how to read/write named cell but I couldn't get list of existing names.
Can you help me ? or provide me link where to find api of existing methods.
Thanks

Michel
Back to top
View user's profile Send private message
Danad
OOo Advocate
OOo Advocate


Joined: 22 Feb 2004
Posts: 293
Location: Brasil

PostPosted: Sat Apr 23, 2005 2:59 pm    Post subject: Reply with quote

Here's for NamedRanges not DatabaseRanges:
Code:

Sub getNamedRanges
   Dim oDoc As Object

   oDoc = ThisComponent
   oRanges = oDoc.NamedRanges
   Nomes = oRanges.getElementNames()
   msg=""
   For i=LBound(Nomes) To UBound(Nomes)
      msg=msg+Nomes(i)+chr(10)
   Next i
   MsgBox msg
End Sub

HTH
Back to top
View user's profile Send private message
mcharp
General User
General User


Joined: 23 Apr 2005
Posts: 10

PostPosted: Sun Apr 24, 2005 8:09 am    Post subject: Reply with quote

Thanks
this is exactly what I was looking for. That works fine.

Additional question:
Where could I find all methods managed by "ThisComponent"
I tried to search in api, but i couldn't find any list of supported methods like "NamedRanges", for example.

I tried also to type in Calc macro editor, ThisComponent. (dot) to get list of object methods (like in VB) but editor doesn't seem to support introspection for object methods.
Could you confirm me that this doesn't work in oooBasic editor.

Michel
Back to top
View user's profile Send private message
Danad
OOo Advocate
OOo Advocate


Joined: 22 Feb 2004
Posts: 293
Location: Brasil

PostPosted: Sun Apr 24, 2005 5:56 pm    Post subject: Reply with quote

Quick way:
Code:

msgBox object.Dbg_SupportedInterfaces
msgBox object.Dbg_Properties
msgBox object.Dbg_Methods


Best way:
1)Download SDK and expand it ( you don't need to install it )
2)Goto www.ooomacros.org, get, install and configure XRay tool

SDK comes with Reference and Developer's Guide (hard, but the best).

Others:
1) Excel/VBA to Calc/Basic: www.oooforum.org/forum/viewtopic.phtml?t=8833
2) Take a look here into CodeSnippets forum, it's very good
3) Download Andrew Pitonyak Free Document ( www.pitonyak.org )

And, we haven't yet some facilities found into some commercial IDEs.

HTH
Back to top
View user's profile Send private message
mcharp
General User
General User


Joined: 23 Apr 2005
Posts: 10

PostPosted: Mon Apr 25, 2005 4:39 am    Post subject: Reply with quote

Thanks again.
Now I have everything I need.
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Tue Apr 26, 2005 9:14 am    Post subject: Reply with quote

Quote:
And, we haven't yet some facilities found into some commercial IDEs.

Yeah, but you should see how the watch window works in the new 2.0 development builds. Pretty awesome!
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Danad
OOo Advocate
OOo Advocate


Joined: 22 Feb 2004
Posts: 293
Location: Brasil

PostPosted: Thu Apr 28, 2005 4:13 pm    Post subject: Reply with quote

Quote:

Yeah, but you should see how the watch window works in the new 2.0 development builds.

Good news, it seems to be promissing.

Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group