Side by Side Table

Side by Side Table

Forum member · Jun 22, 2021
Hi Team, I have an requirement to create two table side by side. How to achieve this? ____________Table A__________ _________Table B_____________ |______________ |______________| |_______________|______________| | | | | | | |______________ |_______________| |______________ |______________| | | | | | | |_______________|______________| | _______________|______________|

Re: Side by Side Table

Support · Jun 22, 2021
Hello, Yes, you can add tables side by side using DynamicPDF Core Suite for .NET . You will need to set required position for Table2 page element by specifying the X and Y position coordinates. Here is a code sample: Document document = new Document(); Page page = new Page(); document.Pages.Add(page); //Create TableA................... Table2 tableA = new Table2(0, 0, 200, 600); tableA.CellDefault.Border.Color = RgbColor.Blue; // Add columns to the table tableA.Columns.Add(100); tableA.Columns.Add(100); // Add rows to the table and add cells to the rows Row2 row1 = tableA.Rows.Add(); row1.Cells.Add("Row1 Cell1"); row1.Cells.Add("Row1 Cell2"); Row2 row2 = tableA.Rows.Add(); row2.Cells.Add("Row2 Cell1"); row2.Cells.Add("Row2 Cell2"); // Add the table to the page page.Elements.Add(tableA); float somepadding = 10; //Calulating position for TableB float xPos = tableA.X + tableA.Width + somepadding; float yPos = tableA.Y; //Create TableB Table2 tableB = new Table2(xPos, yPos, 200, 600); tableB.Border.Color = RgbColor.Red; tableB.CellDefault.Border.Color = RgbColor.Red; // Add columns to the table tableB.Columns.Add(100); tableB.Columns.Add(100); // Add rows to the table and add cells to the rows Row2 tableBrow1 = tableB.Rows.Add(); tableBrow1.Cells.Add("Row1 Cell1"); tableBrow1.Cells.Add("Row1 Cell2"); Row2 tableBrow2 = tableB.Rows.Add(); tableBrow2.Cells.Add("Row2 Cell1"); tableBrow2.Cells.Add("Row2 Cell2"); // Add the table to the page page.Elements.Add(tableB); // Save the PDF string pdfFilePath = @"C:\Temp\MyTable.pdf"; document.Draw(pdfFilePath); Feel free to download the fully functional evaluation edition of DynamicPDF Core Suite for .NET from NuGet (Package ID: ceTe.DynamicPDF.CoreSuite.NET) or from our website here . Thanks, ceTe Software Support Team