Free Support Forum -

Searching Tabels by Name or Bookmark

I’m getting a Table by the following code

Table tableSchedeDE = docDE.getSections().get(1).getBody().getTables().get(0);

but this isn’t a good method, becouse if I put an other Table before that one I have to remember to change everywhere the get() parameter.

Is there a possibility to search and get tables by name or bookmarks or anything else?



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You can try inserting a Bookmark in a table, which you would like to find. Then you can use the following code to find a table:

Document doc = new Document("in.doc");

// Get bookmark

Bookmark bk = doc.Range.Bookmarks["bookmark"];

if (bk != null)


// Get table, where bookmark is located.

Node table = bk.BookmarkStart.GetAncestor(NodeType.Table);

if (table != null)

// Work with table.


Best regards,