Locating a table within a document

Hi,

I am redesigning a system written in VB and writing it in Java. The current system amends values in a table which is stored in the document as a bookmark named "bom". The current VB code to locate the table is:

"If docword.Application.Selection.Bookmarks.Exists("bom") Then"

What code can i use within your Aspose.Words package to locate the table and carry out the table modifications.

Many Thanks.

Ross.

Hi Ross,


Thanks for your inquiry. Please try using the following code to get the required Table containing the Bookmark:
Document doc = new Document(getMyDir() + “in.docx”);

Bookmark bm = doc.getRange().getBookmarks().get(“bm”);
Table tab = (Table)bm.getBookmarkStart().getAncestor(NodeType.TABLE);

if (tab != null)
{
// "Do something useful
}

I hope, this helps.

Best regards,