ByteScout Premium Suite - VB.NET - Create tables in pdf with pdf sdk - ByteScout

ByteScout Premium Suite – VB.NET – Create tables in pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – VB.NET – Create tables in pdf with pdf sdk

How to create tables in pdf with pdf sdk in VB.NET and ByteScout Premium Suite

Learning is essential in computer world and the tutorial below will demonstrate how to create tables in pdf with pdf sdk in VB.NET

ByteScout simple and easy to understand tutorials are planned to describe the code for both VB.NET beginners and advanced programmers. ByteScout Premium Suite: the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can create tables in pdf with pdf sdk in VB.NET.

The following code snippet for ByteScout Premium Suite works best when you need to quickly create tables in pdf with pdf sdk in your VB.NET application. Follow the instructions from scratch to work and copy the VB.NET code. Enjoy writing a code with ready-to-use sample VB.NET codes.

You can download free trial version of ByteScout Premium Suite from our website with this and other source code samples for VB.NET.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.vb
      
Imports Bytescout.PDF ''' <summary> ''' This example demonstrates how to create tables. ''' </summary> Class Program Shared Sub Main() ' Create new document Dim pdfDocument = New Document() pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" ' Add page Dim page = New Page(PaperFormat.A4) pdfDocument.Pages.Add(page) Dim lightGrayColor = New ColorGray(200) Dim whiteColor = New ColorGray(255) Dim lightBlueColor = New ColorRGB(200, 200, 250) Dim lightRedColor = New ColorRGB(255, 200, 200) ' Create a table and set default background color Dim table = New Table() table.BackgroundColor = lightGrayColor ' Add row headers column and set its color table.Columns.Add(New TableColumn("RowHeaders")) table.Columns(0).BackgroundColor = lightGrayColor ' Add columns A, B, C, ... For c As Integer = 0 To 9 Dim columnName = Convert.ToChar(65 + c).ToString() table.Columns.Add(New TableColumn(columnName, columnName)) Next ' Add rows For r As Integer = 0 To 9 ' Create new row and set its background color Dim row = table.NewRow() row.BackgroundColor = whiteColor ' Set row header text row("RowHeaders").Text = (r + 1).ToString() ' Set cell text For c As Integer = 0 To 9 Dim columnName As String = Convert.ToChar(65 + c).ToString() row(columnName).Text = columnName + (r + 1).ToString() Next ' Add the row to the table table.Rows.Add(row) Next ' Decorate the table table.Rows(1)("B").BackgroundColor = lightRedColor table.Columns(2).BackgroundColor = lightBlueColor table.Rows(1).BackgroundColor = lightBlueColor table.Rows(1)("RowHeaders").BackgroundColor = lightBlueColor ' Draw the table on canvas page.Canvas.DrawTable(table, 20, 20) ' Save document to file pdfDocument.Save("result.pdf") ' Cleanup pdfDocument.Dispose() ' Open document in default PDF viewer app Process.Start("result.pdf") End Sub End Class

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next