We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting ordered collection of bookmarks


I wanted to inquire whether the bookmark collection created from the document range is ordered - i.e, I wanted to know if the bookmarks in the collection are ordered according to the position they appear in the word document.

for(Bookmark b: doc.getRange.getBookmarks()){



Hi Praneeth,

Thanks for your inquiry. Yes, Range.getBookmarks method returns a bookmarks collection that represents all bookmarks in the range. The bookmarks in the collection are ordered same as they appear in Word document and Aspose.Words DOM. Please read the following articles for more information on DOM:

Please let us know if you have any more queries.

Hey Tahir,

Thank you for confirming this. I hadn't seen this as part of the javadocs for BookmarkCollection so I just wanted to make sure.

Hi Praneeth,

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.