Directly Accessing Bookmarks in Aspose.Words

Hello,

I’m currently using version 3.5.1. Is it possible to access a bookmark directly by name in code? The reason is because we have a 100 page document that has a lot of bookmarks. Instead of looping through the collection like below for every bookmark to place text in it, can we just access the bookmark directly?

'Like this:
Dim bookmarks As Bookmarks = doc.Range.Bookmarks
For Each bookm As Bookmark In bookmarks
'Do something
Next

’Or like:
Dim doc As Document = New Document("MyDocument.doc")

Dim bookmarks As BookmarkCollection = doc.Range.Bookmarks 

Dim bookmark As Bookmark = bookmarks("Bookmark")

Basically I’m trying to get away from the doc.Range aspect, which I think is causing our performance hit. We just have too many Section Breaks.

Thanks.

Hi
Thanks for your inquiry. You can access to bookmark only using Range. Please see the following code snippet.

doc.Range.Bookmarks.Item("myBookmark")

Best regards.