| View previous topic :: View next topic |
| Author |
Message |
vsugumar2002 General User

Joined: 26 Apr 2007 Posts: 26 Location: Chennai
|
Posted: Thu Jul 05, 2007 1:47 am Post subject: how to traverse all bookmarks in openoffice document? |
|
|
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 |
|
 |
hffm Power User

Joined: 22 Jul 2005 Posts: 52 Location: GERARDMER FRANCE
|
Posted: Thu Jul 05, 2007 5:44 am Post subject: |
|
|
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 |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3623 Location: Columbus, Ohio, USA
|
Posted: Thu Jul 05, 2007 6:43 am Post subject: |
|
|
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 |
|
 |
vsugumar2002 General User

Joined: 26 Apr 2007 Posts: 26 Location: Chennai
|
Posted: Fri Jul 06, 2007 2:13 am Post subject: How to find the bookmark? |
|
|
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 |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3623 Location: Columbus, Ohio, USA
|
Posted: Fri Jul 06, 2007 1:13 pm Post subject: |
|
|
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 |
|
 |
|