Is it possible to get a reference to a table using a bookmark in c#? I can get plain references to paragraph bookmarks, but don’t know how to cast/obtain a table reference.
PS, I may be able to do it a different way, but I’ll leave this question here in case there’s an easy answer. Don’t spend any time trying to figure it out if there’s no easy way. I’m not just curious on this option now.
Thanks for your inquiry. Please try following code example to get the table when bookmark is inside the table. Hope this helps you. If you still face problem, please share your input document here for our reference. We will then provide you more information about your query along with code.
Document doc = new Document(MyDir + "in.docx");
Node table = doc.Range.Bookmarks["bookmark"].BookmarkStart.GetAncestor(NodeType.Table);
if (table != null)