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 traverse all bookmarks in openoffice document?

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


Joined: 26 Apr 2007
Posts: 26
Location: Chennai

PostPosted: Thu Jul 05, 2007 1:47 am    Post subject: how to traverse all bookmarks in openoffice document? Reply with quote

Hi,

I have a openoffice document. I want to traverse all the bookmarks in openoffice document using visual basic 6. Shall you give any one solution to this problem?
_________________
Thanks & Regards
Sugumar.V
Back to top
View user's profile Send private message
hffm
Power User
Power User


Joined: 22 Jul 2005
Posts: 52
Location: GERARDMER FRANCE

PostPosted: Thu Jul 05, 2007 5:44 am    Post subject: Reply with quote

Hello.
It depends on your knowledge on how to manage the bookmarks.
If you already know how to get the active document:
Code:
Dim ActiveDoc as Object
Set ActiveDoc = MyDesktop.getCurrentComponent

you can access to all the bookmarks by method getBookmarks
Code:
Dim MyBookmarks as object
Set Bookmarks = ActiveDoc.getBookmarks

so you can iterate trough bookmarks with vb methods with For each next enumation:
Once you have the bookmarks collection the methods count, hasbyname and so on are implemented:
Code:
Public Function Count() As Long
'utilisée pour lire le nombre d'éléments dans la
    Count = MyBookmarks.Count
End Function
Public Function HasByName(BookmarkName As String) As Boolean
    HasByName = MyBookmarks.HasByName(BookmarkName)
End Function

See SDK for other functions: container and bookmarks...
Back to top
View user's profile Send private message Visit poster's website
pitonyak
Administrator
Administrator


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

PostPosted: Thu Jul 05, 2007 6:43 am    Post subject: Reply with quote

The method suggested by hffm is the most reliable method to enumerate the bookmarks. If required, it is possible to iterate through the text content and find the bookmarks, but this is complicated.
_________________
--
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
vsugumar2002
General User
General User


Joined: 26 Apr 2007
Posts: 26
Location: Chennai

PostPosted: Fri Jul 06, 2007 2:13 am    Post subject: How to find the bookmark? Reply with quote

Hi,

Thanks for your reply.

I have one more doubts, i have a open office document. I don't know bookmark name. how to find the bookmark name using visual basic 6? Shall you give the solution to this problem?
_________________
Thanks & Regards
Sugumar.V
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


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

PostPosted: Fri Jul 06, 2007 1:13 pm    Post subject: Reply with quote

No comment on VB, but this should demonstrate how I see the names in StarBasic
Code:
MsgBox Join(ThisComponent.getBookmarks().getElementNames(), CHR$(10))

_________________
--
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
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