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

Free Support Forum - aspose.com

Unexpected Bookmarkend nodes found directly under body

BookmarkEnd nodes are displayed at the same level as paragraph node if the bookmark contains empty new lines.
Issue found on Aspose Words it does not reproduce using version
BookmarkStart nodes are displayed as children of paragraph nodes as in previous versions.
I’ve created a sampleTest6.zip (9.0 KB) document and some demo code to reproduce the issue:

               Document doc = new Document("C:\\_Test\\Test6.docx");        
               Body body = doc.FirstSection.Body; 
               List<NodeType> Types = new List<NodeType>();
               var next = body.FirstChild;
               while (next != null)
                next = next.NextSibling;

Please confirm if this is a bug on the new Aspose Words version.


Thanks for your inquiry. The bookmark nodes are allowed to be placed on the block, cell and row levels in the latest version of Aspose.Words for .NET 18.10. We suggest the you please read the following article.
Working with Bookmark on Block, Cell, Row Levels

Thank you for the response Tahir,

Our concern regarding the BookmarkEnd nodes that now appear at the same level with Paragraph nodes in this specific scenario is that their corresponding BookmarkStart are not on the same level.
We can work-around the issue on our side by ignoring BookmarkEnd notes but I need confirmation that, for this specific scenario, the presence of the BookmarkEnd nodes at that level is expected.


Thanks for your inquiry. Yes, it is possible that BookmarkEnd node exists at block level.

If you want to open a document in the inline-bookmarks mode, please set the value of LoadOptions.AnnotationsAtBlockLevel property as false .

Thank you Tahir,

We’ll look into using the AnnotationsAtBlockLevel.
Just to clarify, the fact that the BookmarkStart and BookmarkEnd nodes are at different levels in this scenario is expected?


Thanks for your inquiry. Yes, the BookmarkStart and BookmarkEnd nodes can exist at different levels in the Aspose.Words’ DOM.


Thanks for re-confirming Tahir.
We’ve tried using the AnnotationsAtBlockLevel and it warns us that this setting may become obsolete in future versions.
Is it going to be replaced with another setting already in the product? Perhaps we can use the new setting directly.


Thanks for your inquiry. In the previous versions bookmarks were moved into the next nearest paragraph on document loading. So, the bookmarks at Block, Cell, Row levels were imported incorrectly. Due to this incorrect behavior, the property LoadOptions.AnnotationsAtBlockLevel will be obsolete in future. If your document has block level bookmarks, please modify your code accordingly. We suggest you please read API changes about block level bookmarks from here:
Aspose.Words for .NET 18.9 Release Notes