Bookmarks in tables spaning accross multimpe columns and rows

We are trying to insert a bookmark that contains a sub-range from a table, like in the attached WordCreatedBookmark.png.
Using the following code:

using(var ms = new MemoryStream(File.ReadAllBytes(@"C:\1.docx")))
{
    var doc = new Document(ms);

    var bookmarkStart = new BookmarkStart(doc, "bookmark");
    var bookmarkEnd = new BookmarkEnd(doc, "bookmark");

    var table = (Table) doc.GetChildNodes(NodeType.Table, true)[0];

    table.Rows[1].Cells[1].Paragraphs[0].ChildNodes.Insert(0, bookmarkStart);
    table.Rows[5].Cells[3].Paragraphs[table.Rows[5].Cells[3].Paragraphs.Count - 1].ChildNodes.Add(bookmarkEnd);

    doc.Save(@"C:\Users\IBM_ADMIN\Desktop\11.docx", SaveFormat.Docx);
}

We are getting the result from AsposeCreatedBookmark.png. As you can observe from the attached images inserting a bookmark with Aspose is not having the desired effect.

After investigating the Microsoft Word behavior we concluded that it is using the “colFirst” and “colLast” attributes on the bookmarkStart XML element, like:

<w:bookmarkStart w:id="0" w:name="bookmark" w:colFirst="1" w:colLast="3"/>

Please let us know if there is a way to atchive the described behavior.

Thank you,
Lucian Nistor

Hi Lucian,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we had already logged this feature request as WORDSNET-721 (Improve table bookmarks) 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 WORDSNET-721) have been fixed in this Aspose.Words for .NET 18.9 update and this Aspose.Words for Java 18.9 update.

@ibmromania

In old versions of Aspose.Words, the BookmarkStart and BookmarkEnd nodes are imported into Aspose.Words’ DOM as inline node i.e. inside Paragraph node.

We added support of bookmark import in Aspose.Words 18.9 version according to document structure. Now, bookmark position is preserved in document node structure on import and export of DOCX, DOC, WML documents.