I am having a wierd problem with deleting a bookmark – wierd because I’m deleting literally 100’s of others without a hitch, but this one is failing in a way I don’t understand.
Here is a code fragment:
If docNode.NodeType = NodeType.BookmarkStart Then
If docNode.ParentNode.NodeType = NodeType.Paragraph Then
Dim parent As Aspose.Words.Paragraph = docNode.ParentNode
If parent.ChildNodes.Count = 0 Then
Examining the HTML, I find
With the bookmarkStart and bookmarkEnd nodes immediately adjacent to each other, and same id. Just like most every other position bookmark.
When I look at the properties in VS2008 debugger, everything looks right: the Bookmark property of the node has a BookmarkStart and a BookmarkEnd, both with the name "ltProratedEquipment" and no text. But when I execute the docNode.Bookmark.Remove() function, the properties in the debugger shows that the Bookmark.BookmarkEnd property now has the Message "Exception 'Cannot find bookmark 'ltProratedEquipment' in the document.' occured in Aspose.Words for .NET 188.8.131.52.
For free technical support, please post this error and the file in the Aspose.Words Forums http://www.aspose.com/forums/ShowForum.aspx?ForumID=75." However, it does not throw an exception. When I make the next pass through the loop, the BookmarkEnd node is still there, and if I try to delete it, it does throw an exception saying it cannot delete it because it has no parent.
I do not understand what is going on and why this book mark is behaving differently from all the others.
Can somebody help?