Hello
I want to display two table in single table in different cell
here I want to create a table with two row and one cell
in first row and first cell I want to display one table
and in second row I want another
do you have any solution for that
Thanks
Shakti
Hello Shakti,
Thanks for considering Aspose.
Do you need to create tables as illustrated in the attached snapshot? If so, please try using the following code snippet to accomplish your requirement. I’ve also attached the resultant PDF document; please take a look.
If it does not satisfy your requirement or I’ve not properly understood it, please share an image file that can guide us to comprehend the requirement.
[C#]
Pdf pdf1 = new Pdf();
// Create a Pdf section object
Aspose.Pdf.Section sec = pdf1.Sections.Add();
// Instantiate a table object
Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table();
// Add the table in paragraphs collection of the desired section
sec.Paragraphs.Add(tab1);
// Set with column widths of the table
tab1.ColumnWidths = "170";
// Set default cell border using BorderInfo object
tab1.DefaultCellBorder = new BorderInfo((int)BorderSide.All, 1F);
// Set table border using another customized BorderInfo object
tab1.Border = new BorderInfo((int)BorderSide.All, 1F);
// Create MarginInfo object and set its left, bottom, right, and top margins
MarginInfo margin = new MarginInfo();
margin.Top = 5f;
margin.Left = 5f;
margin.Right = 5f;
margin.Bottom = 5f;
// Set the default cell padding to the MarginInfo object
tab1.DefaultCellPadding = margin;
for (int i = 1; i <= 2; i++) {
// Create rows in the table and then cells in the rows
Aspose.Pdf.Row row1 = tab1.Rows.Add();
// Create an inner table to be displayed in the outer table
Aspose.Pdf.Table innertable = new Aspose.Pdf.Table();
// Set default cell border using BorderInfo object
innertable.DefaultCellBorder = new BorderInfo((int)BorderSide.All, 1F, new Aspose.Pdf.Color("Blue"));
// Set the column width of the inner table
innertable.ColumnWidths = "80 80";
innertable.DefaultCellPadding = margin;
// Set the background color for inner table
innertable.BackgroundColor = new Aspose.Pdf.Color("Silver");
// Set the foreground color for the text of innertable
innertable.DefaultCellTextInfo.Color = new Aspose.Pdf.Color("White");
// Add the first column in 1st row of inner table
innertable.Rows.Add().Cells.Add("Column (0, 0)");
// Add the 2nd column in 1st row of inner table
innertable.Rows[0].Cells.Add("Column (0, 1)");
// Add the first column in 2nd row of inner table
innertable.Rows.Add().Cells.Add("Column (1, 0)");
// Add the 2nd column in 2nd row of inner table
innertable.Rows[1].Cells.Add("Column (1, 1)");
// Add the inner table to paragraphs collection of row of outer table
row1.Cells.Add().Paragraphs.Add(innertable);
}
// pdf1.Bookmarks.Add(tocbookmark);
pdf1.Save(@"d:/pdftest/Table_InsideTable.pdf");
Thanks sir