ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Place (Align) two tables side by side using iTextSharp in C# and VB.Net<p>Hi <a class="username" rel="smile"> smile</a>,</p> <p>Refer below sample.</p> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.IO; using iTextSharp.text; using iTextSharp.text.pdf;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.IO Imports iTextSharp.text Imports iTextSharp.text.pdf</pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">private void Form1_Load(object sender, EventArgs e) { string folderPath = @&#34;C:\Users\anand\Desktop\Test\\&#34;; FileStream stream = new FileStream(folderPath + &#34;DataGridViewExport.pdf&#34;, FileMode.Create); Document doc = new Document(PageSize.A4.Rotate(), 5f, 5f, 5f, 5f); PdfWriter pdfWriter = PdfWriter.GetInstance(doc, stream); doc.Open(); PdfContentByte content = pdfWriter.DirectContent; PdfPTable mtable = new PdfPTable(2); mtable.WidthPercentage = 100; mtable.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER; PdfPTable table = new PdfPTable(5); table.WidthPercentage = 100; PdfPCell cell = new PdfPCell(new Phrase(&#34;Assesssment 1 Term 2&#34;)); cell.Colspan = 6; cell.HorizontalAlignment = 1; table.AddCell(cell); table.AddCell(&#34;Strength&#34;); table.AddCell(&#34;Lowest %&#34;); table.AddCell(&#34;Heighest %&#34;); table.AddCell(&#34;Average&#34;); table.AddCell(&#34;Grade&#34;); table.AddCell(&#34;A1-T2&#34;); table.AddCell(&#34;89.00&#34;); table.AddCell(&#34;99.00&#34;); table.AddCell(&#34;275&#34;); table.AddCell(&#34;A+&#34;); mtable.AddCell(table); table = new PdfPTable(5); table.WidthPercentage = 100; cell = new PdfPCell(new Phrase(&#34;Assesssment 2 Term 2&#34;)); cell.Colspan = 5; cell.HorizontalAlignment = 1; table.AddCell(cell); table.AddCell(&#34;Strength&#34;); table.AddCell(&#34;Lowest %&#34;); table.AddCell(&#34;Heighest %&#34;); table.AddCell(&#34;Average&#34;); table.AddCell(&#34;Grade&#34;); table.AddCell(&#34;A2-T2&#34;); table.AddCell(&#34;14.00&#34;); table.AddCell(&#34;99.00&#34;); table.AddCell(&#34;398&#34;); table.AddCell(&#34;A+&#34;); mtable.AddCell(table); doc.Add(mtable); doc.Close(); }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Dim folderPath As String = &#34;C:\Users\anand\Desktop\Test\\&#34; Dim stream As FileStream = New FileStream(folderPath &amp; &#34;DataGridViewExport.pdf&#34;, FileMode.Create) Dim doc As Document = New Document(PageSize.A4.Rotate(), 5.0F, 5.0F, 5.0F, 5.0F) Dim pdfWriter As pdf.PdfWriter = pdfWriter.GetInstance(doc, stream) doc.Open() Dim content As PdfContentByte = pdfWriter.DirectContent Dim mtable As PdfPTable = New PdfPTable(2) mtable.WidthPercentage = 100 mtable.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER Dim table As PdfPTable = New PdfPTable(5) table.WidthPercentage = 100 Dim cell As PdfPCell = New PdfPCell(New Phrase(&#34;Assesssment 1 Term 2&#34;)) cell.Colspan = 6 cell.HorizontalAlignment = 1 table.AddCell(cell) table.AddCell(&#34;Strength&#34;) table.AddCell(&#34;Lowest %&#34;) table.AddCell(&#34;Heighest %&#34;) table.AddCell(&#34;Average&#34;) table.AddCell(&#34;Grade&#34;) table.AddCell(&#34;A1-T2&#34;) table.AddCell(&#34;89.00&#34;) table.AddCell(&#34;99.00&#34;) table.AddCell(&#34;275&#34;) table.AddCell(&#34;A+&#34;) mtable.AddCell(table) table = New PdfPTable(5) table.WidthPercentage = 100 cell = New PdfPCell(New Phrase(&#34;Assesssment 2 Term 2&#34;)) cell.Colspan = 5 cell.HorizontalAlignment = 1 table.AddCell(cell) table.AddCell(&#34;Strength&#34;) table.AddCell(&#34;Lowest %&#34;) table.AddCell(&#34;Heighest %&#34;) table.AddCell(&#34;Average&#34;) table.AddCell(&#34;Grade&#34;) table.AddCell(&#34;A2-T2&#34;) table.AddCell(&#34;14.00&#34;) table.AddCell(&#34;99.00&#34;) table.AddCell(&#34;398&#34;) table.AddCell(&#34;A+&#34;) mtable.AddCell(table) doc.Add(mtable) doc.Close() End Sub</pre> <p><span style="text-decoration: underline;"><strong>Screenshot</strong></span></p> <p><img src="https://imgur.com/LBD0nB4.jpg" alt="" width="718" height="134" /></p>https://www.aspforums.net:443/Threads/778493/Place-Align-two-tables-side-by-side-using-iTextSharp-in-C-and-VBNet/https://www.aspforums.net:443/Threads/778493/Place-Align-two-tables-side-by-side-using-iTextSharp-in-C-and-VBNet/Thu, 16 May 2019 03:39:17 GMT