hi,
i can’t create nested table in aspose.word dynamically using c#
hi,
i can’t create nested table in aspose.word dynamically using c#
Hi Kirupananthan,
Please use the following code snippet to create nested table. Let us know, If you have any further queries.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Build the outer table.
Aspose.Words.Tables.Cell cell = builder.InsertCell();
builder.Writeln("Outer Table Cell 1");
builder.InsertCell();
builder.Writeln("Outer Table Cell 2");
// This call is important in order to create a nested table within the first table
// Without this call the cells inserted below will be appended to the outer table.
builder.EndTable();
// Move to the first cell of the outer table.
builder.MoveTo(cell.FirstParagraph);
// Build the inner table.
builder.InsertCell();
builder.Writeln("Inner Table Cell 1");
builder.InsertCell();
builder.Writeln("Inner Table Cell 2");
builder.EndTable();
doc.Save(MyDir + "DocumentBuilder.InsertNestedTable Out.doc");
exception:
Aspose.Words.Tables.Cell cell = builder.InsertCell();
The type name ‘Cell’ does not exist in the type ‘Aspose.Words.Tables’
Is this any dll problem?
Hi Kirupananthan,
Are you using the latest version of Aspose.Words for .NET? Please check this documentation link.
Hi Kirupananthan,
Please use following code snippet to create inner table in second cell of outer table.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Build the outer table.
Aspose.Words.Tables.Cell cell = builder.InsertCell();
builder.Writeln("Outer Table Cell 1");
Aspose.Words.Tables.Cell cell2 = builder.InsertCell();
builder.Writeln("Outer Table Cell 2");
// This call is important in order to create a nested table within the first table
// Without this call the cells inserted below will be appended to the outer table.
builder.EndTable();
// Move to the second cell of the outer table.
builder.MoveTo(cell2.FirstParagraph);
// Build the inner table.
builder.InsertCell();
builder.Writeln("Inner Table Cell 1");
builder.InsertCell();
builder.Writeln("Inner Table Cell 2");
builder.EndTable();
doc.Save(MyDir + "DocumentBuilder.InsertNestedTable Out.doc");
I am trying to do mailmerge in Aspose.Words using Dataset created from the xml . The Table is nested type as shown below. What should be the input xml structure and do you have any cod snippets. It will help a lot.
Additional Information
Question 1
Question 2
Question 1
Question 2
Question
1
Question
2
[AJ1]This section is configurable. This will consist of group of Questions clubbed under a Section ->Tab. Format same as ‘Stakeholder Information’. If more than one tab is available, then Tab is displayed on the screen
v
Hi there,
Thanks for your inquiry. I would suggest you please read the following articles. Hope this helps you.
https://docs.aspose.com/words/net/mail-merge-with-xml-data-source/
https://docs.aspose.com/words/java/nested-mail-merge-with-regions/
If you face any issue, please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate, how you want your final Word output be generated like. We will then provide you more information on this along with code.
Please let me know if I can be of any further assistance.