Free Support Forum - aspose.com

How to put 2 tables side by side on pdf document

Hello,

I need to put two tables side by side on my PDF document

when i do this:

...

Dim tab1 As Aspose.Pdf.Table = New Aspose.Pdf.Table()

Dim tab2 As Aspose.Pdf.Table = New Aspose.Pdf.Table()

sec1.Paragraphs.Add(tab1)

sec1.Paragraphs.Add(tab2)

...

tab2 is created below tab1 and i want them to be next to each other

I have no idea how to do it

Hi,

Thank you for considering Aspose.

You can use nested table.

Hi,

Thankyou for considering Aspose.Pdf

Yes its prety possible to add two table side by side. Infact logically its like adding a table into another table.

To add a nested table, all you need is to add a new table into the paragraphs collection of any desired cell. Simply create a table, than add a row to the table. Create 2 columns and in second column add another table.

//Create a table
Table tab1 = new Table();

//Add the table into the paragraphs collection of section

sec1.Paragraphs.Add(tab1);

//Add a row into the table

Row row1 = tab1.Rows.Add();

//Add 1st cell in the row

row1.Cells.Add("left cell");

//Add 2nd cell in the row

Cell cell2 = row1.Cells.Add();

//Create a table to be nested with the reference of 2nd cell in the row

Table tab2 = new Table(cell2);

//Add the nested table into the paragraphs collection of the 2nd cell

cell2.Paragraphs.Add(tab2);

For more information visit Create Nested Table