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

Free Support Forum - aspose.com

About index of bookmark in aspose word document

Hi,

I have aspose word document that have bookmarks and I need to loop through bookmarks in order that content of bookamrk appears in word visually.

My question is when I loop through bookmarks in word document using doc.Range.Bookmarks are they in order already? if not how do I order them correctly.

Thanks,
Meet Patel

@meetp

Yes, the bookmarks are in the order as they appear in the document. Following code example shows how to get the name of bookmarks.

Document doc = new Document(MyDir + "in.docx");
foreach (Bookmark bookmark in doc.Range.Bookmarks)
{
    Console.WriteLine(bookmark.Name)
}