BookmarkStart and BookmarkEnd position is incorrect when bookmark is in ranges of cells using C#

I created simple table with few bookmarks in MS Word.

and looked on DOM via Document Explorer

So, regardless of bookmark range, BookmarkStart always in first cell of the row and BookmarkEnd in first cell of the next row or, on case of last row, in next paragraph after table. Can you please explan me this logic? How can I work with few marked cell of the row, like in bm2?

@agafonov_av,

Thanks for your inquiry. The BookmarkEnd node is inline node and child of Paragraph node. If you select the last row of table while inserting the bookmark, MS Word inserts the BookmarkEnd node in the next paragraph. This is the expected behavior of MS Word. However, you can insert the BookmarkEnd node in the last paragraph of a table’s cell using Aspose.Words.

Thanks for your reply. Ok, I understand situation with last row. What about case like bm2? It’s not last row, only 2 middle cells selected in Word, but still bm2 contains entire row in Aspose. Can I someway understand which exactly cells was wrapped in bookmark? Modify BookmarkStart/End using Aspose is not option in my case.

@agafonov_av,

Thanks for sharing the detail. When the bookmark is in ranges of cells, it is imported incorrectly in Aspose.Words DOM. This is a missing feature. We have logged it as WORDSNET-15768 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan

A post was split to a new topic: Working with Bookmarks and Tables

@agafonov_av,

Thanks for your patience. We added new properties in Bookmark class in new version of Aspose.Words. Please use Bookmark.IsColumn proeprty to check if bookmark is a table column bookmark.

In your case, the problematic bookmark is column bookmark. You can detect such bookmarks using Bookmark.IsColumn property and get actual start/end from related bookmark properties (Bookmark.FirstColumn and Bookmark.LastColumn).

We will close this issue after your feedback. Please let us know if you have any more queries.