Hi Arvind,
Thanks for your inquiry. Sure, you can create a similar nested table by using the following code snippet:
DocumentBuilder builder = new DocumentBuilder();
builder.Font.Name = "Calibri";
builder.Font.Size = 11;
builder.RowFormat.HeightRule = HeightRule.AtLeast;
builder.RowFormat.Height = 0.29 * 72;
Table parentTable = builder.StartTable();
builder.InsertCell();
builder.Write("1st Row");
builder.InsertCell();
builder.InsertCell();
builder.EndRow();
builder.InsertCell();
builder.Write("2nd Row");
builder.InsertCell();
builder.InsertCell();
builder.EndRow();
builder.InsertCell();
builder.Write("3rd Row");
builder.InsertCell();
builder.InsertCell();
builder.EndRow();
builder.InsertCell();
Table nestedTable = builder.StartTable();
builder.InsertCell();
builder.Write("4th
sub row 1");
builder.EndRow();
builder.InsertCell();
builder.Write("4th
sub row 2");
builder.EndRow();
builder.InsertCell();
builder.Write("4th
sub row 3");
builder.EndRow();
builder.InsertCell();
builder.Write("4th
sub row 4");
builder.EndRow();
builder.EndTable();
nestedTable.PreferredWidth = PreferredWidth.FromPoints(1.13 * 72);
builder.InsertCell();
builder.InsertCell();
builder.EndRow();
builder.InsertCell();
builder.Write("5th Row");
builder.InsertCell();
builder.InsertCell();
builder.EndRow();
builder.InsertCell();
builder.Write("6th Row");
builder.InsertCell();
builder.InsertCell();
builder.EndRow();
builder.EndTable();
parentTable.PreferredWidth = PreferredWidth.FromPoints(3.88 * 72);
builder.Document.Save(@"C:\temp\out.docx");
Please also watch
this video to learn how to create Table from scratch, insert content inside this table and apply different formatting using
DocumentBuilder class.
I hope, this helps.
Best regards,