Free Support Forum - aspose.com

Getting bookmarks problem from word document

Hi,

Issue1: I created two bookmarks in word document when i am reading bookmarks getting error like
((Aspose.Words.Bookmark)((new
System.Linq.SystemCore_EnumerableDebugView(bookmark
list)).Items[1])).Text threw an exception of type
'System.InvalidOperationException

Issue2: suppose if i created two bookmarks sometimes getting bookmarks count 3 sometimes count 2

my code:
Aspose.Words.Document doc = new Aspose.Words.Document(dataDir + “/” + file.FileName);

BookmarkCollection bookmarklist = doc.Range.Bookmarks;



Hi Sreedhar,


Thanks for your inquiry.
Sreedhar:
Issue1: I created two bookmarks in word document when i am reading bookmarks getting error like
((Aspose.Words.Bookmark)((new System.Linq.SystemCore_EnumerableDebugView(bookmark list)).Items[1])).Text threw an exception of type 'System.InvalidOperationException
Please create a standalone runnable console application that helps us reproduce this problem on our end and attach it here for testing. As soon as you get this simple application ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.
Sreedhar:
Issue2: suppose if i created two bookmarks sometimes getting bookmarks count 3 sometimes count 2

my code:
Aspose.Words.Document doc = new Aspose.Words.Document(dataDir + “/” + file.FileName);

BookmarkCollection bookmarklist = doc.Range.Bookmarks;

While using the latest version of Aspose.Words i.e. 14.11.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-11261. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Hi Sreedhar,


Thanks for being patient. Regarding WORDSNET-11261, our product team has completed the work on your issue and has come to a conclusion that this issue and the undesired behaviour you’re observing is actually not a bug in Aspose.Words. So, we will close this issue as ‘Not a Bug’.

The Document.Range.Bookmarks collection contains more bookmarks than the customer has created because there also is the ‘_Goback’ bookmark. It is MS Word special hidden bookmark that enables the Go Back to Last Editing Point functionality (Shift+F5). In document.xml it is stored as usual bookmark.

The Bookmarks collection of the VBA Microsoft.Office.Interop.Word.Document class also contains the ‘_GoBack’ bookmark. If we can help you with anything else, please feel free to ask.

Best regards,