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

Free Support Forum - aspose.com

The maximum number of bookmarks in a Word document

Hello

I was adding bookmarks to a Word document using DocumentBuilder in Aspose.Words.
I added about 1100 bookmarks, but I can retrieve about 1054 bookmarks later from the following property: Document.Range.Bookmarks

Microsoft documentation says a Word document can have up to 2,147,483,647 bookmarks.

Is this a bug in Aspose.Words?

@valuepro Could you please share your code here for testing? We will check the issue and provide you more information.
I have checked with the following simple code and all bookmarks are retrieved properly:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

for (int i = 0; i < 11000; i++)
{
    string bookmarkName = string.Format("b_{0}", i);
    builder.StartBookmark(bookmarkName);
    builder.Write(bookmarkName);
    builder.EndBookmark(bookmarkName);
    builder.Writeln();
}

Console.WriteLine(doc.Range.Bookmarks.Count);

doc.Save(@"C:\Temp\out.docx");
doc = new Document(@"C:\Temp\out.docx");
            
Console.WriteLine(doc.Range.Bookmarks.Count);

Also, please make sure you are using Aspose.Words in licensed mode. If Aspose.Words is used in evaluation mode, the document might be truncated due to the evaluation version limitations and you get less bookmarks than in the document.