How to set bookmark id to aspose word table

How to set bookmark id to aspose word table?

@vineeth.pv Unfortunately, your question is not clear enough. Could you please elaborate your requirement in more details and attach your input document the expected output document here for our reference?

@alexey.noskov I need to give a bookmark id to a table. I tried the below method. unfortunately, it’s not working. I cannot set the bookmark id to aspose.word.table. any proper method to set bookmark id to the table

builderResult.StartBookmark("table1");
Table table = MasterFileTables[index] as Table;
RowCollection rows = table.Rows;
      foreach (Row row in rows)
      {
           CellCollection cells = row.Cells;
           foreach (Cell cell in cells)
           {
               builderResult.Write(cell .GetText());
           }
      }
     builderResult.EndRow(); 
}
builderResult.EndTable();
builderResult.EndBookmark("table1");

@vineeth.pv If you need to identify table by bookmark, you can put the bookmark into the first cell in the table and then get the ancestor table of the appropriate bookmark. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);

// Put bookmakrs in the table to be able later get table by the bookmark.
int bkIndex = 0;
foreach (Table t in doc.GetChildNodes(NodeType.Table, true))
{
    // Move DocumentBuilder cursor into the first table cell and insert bookmark.
    string bkName = string.Format("table_{0}", bkIndex);
    bkIndex++;

    builder.MoveTo(t.FirstRow.FirstCell.FirstParagraph);
    builder.StartBookmark(bkName);
    builder.EndBookmark(bkName);
}

//...........................................

// Now you can get table by bookmakr name
Table table = (Table)doc.Range.Bookmarks["table_0"].BookmarkStart.GetAncestor(NodeType.Table);
// Do something with table
// ..........................................