Access the inner table from Document builder

hi, I have a template. Inside a table, I have a table inside the table. how can I access the inner table using DocumentBuilder? The inner table has a bookmark and I have to create the rows inside the inner tabletablecontent.png (1.0 KB)
tablecontent_Output.png (1.9 KB)

@gurpreet.singh

Please move the cursor to the bookmark and create the table using DocumentBuilder. Please read the following article.

Navigation with Cursor

Thanks tahir. i have gone through the artical. but my requirement is to create the rows in an existing table from builder. i am not able to find the inner table.

Bookmark bookmark = doc.Range.Bookmarks[bookmarkName]
Table table = bookmark.BookmarkStart.GetAncestor(NodeType.Table);
I have the table but I don’t now how to move the builder in this table.

i can create new row without builder
Row row = new Row(doc);
table.AppendChild(row);
Cell cell = new Cell(doc);
cell.AppendChild(new Paragraph(doc));
cell.FirstParagraph.AppendChild(new Run(doc, “SomeValue”));
this is HTML text that’s why i want to use document builder.insertHTML method

@gurpreet.singh

Please ZIP and attach your input and expected output documents. We will investigate the issue and provide you more information about your query along with code example.

Tahir.zip (38.3 KB)

@gurpreet.singh

Please use the following code example to get the desired output. Hope this helps you.

var document = new Aspose.Words.Document(MyDir + "InputTemplate.docx");
var builder = new DocumentBuilder(document);
Bookmark bookmark = document.Range.Bookmarks["Coverage"];
Table table = (Table)bookmark.BookmarkStart.GetAncestor(NodeType.Table);
table.Rows.Add(table.LastRow.Clone(true));
foreach (Cell cell in table.LastRow.Cells)
{
    cell.RemoveAllChildren();
    cell.EnsureMinimum();
    builder.MoveTo(cell.FirstParagraph);
    builder.InsertHtml("your html....");
}

document.Save(MyDir + "20.7.docx");

thanks tahir, your sample works for me.