ByteScout PDF SDK - VBScript and VB6 - Draw Tables in PDF - ByteScout

ByteScout PDF SDK – VBScript and VB6 – Draw Tables in PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – VBScript and VB6 – Draw Tables in PDF

How to draw tables in PDF in VBScript and VB6 using ByteScout PDF SDK

How to draw tables in PDF in VBScript and VB6

ByteScout tutorials are designed to explain the code for both VBScript and VB6 beginners and advanced programmers. ByteScout PDF SDK is the pdf library that can create, update and modify PDF files. Supports text with fonts and style selections, layers, form fields, drawing lines and objects, automatic tables, images. Can be used to create and fill pdf forms and you can use it to draw tables in PDF with VBScript and VB6.

Fast application programming interfaces of ByteScout PDF SDK for VBScript and VB6 plus the instruction and the code below will help you quickly learn how to draw tables in PDF. In your VBScript and VB6 project or application you may simply copy & paste the code and then run your app! Enjoy writing a code with ready-to-use sample codes in VBScript and VB6.

Our website provides trial version of ByteScout PDF SDK for free. It also includes documentation and source code samples.

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

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

Tables.vbs
      
' This example demonstrates how to create tables. ' Create Bytescout.PDF.Document object Set pdfDocument = CreateObject("Bytescout.PDF.Document") pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" Set comHelpers = pdfDocument.ComHelpers ' Add page Set page1 = comHelpers.CreatePage(comHelpers.PAPERFORMAT_A4) pdfDocument.Pages.Add(page1) Set lightGrayColor = comHelpers.CreateColorGray(200) Set whiteColor = comHelpers.CreateColorGray(255) Set lightBlueColor = comHelpers.CreateColorRGB(200, 200, 250) Set lightRedColor = comHelpers.CreateColorRGB(255, 200, 200) ' Create a table and set default background color Set table = comHelpers.CreateTable() table.BackgroundColor = lightGrayColor ' Add row headers column and set its color table.Columns.Add(comHelpers.CreateTableColumn("RowHeaders", "")) table.Columns.Item(0).BackgroundColor = lightGrayColor ' Add columns A, B, C, ... For c = 0 To 9 columnName = Chr(65 + c) table.Columns.Add(comHelpers.CreateTableColumn(columnName, columnName)) Next ' Add rows For r = 0 To 9 ' Create new row and set its background color Set row = table.NewRow() row.BackgroundColor = whiteColor ' Set row header text row("RowHeaders").Text = CStr(r + 1) ' Set cell text For c = 0 To 9 columnName = Chr(65 + c) row(columnName).Text = columnName + CStr(r + 1) Next ' Add the row to the table table.Rows.Add(row) Next ' Decorate the table table.Rows.Item(1)("B").BackgroundColor = lightRedColor table.Columns.Item(2).BackgroundColor = lightBlueColor table.Rows.Item(1).BackgroundColor = lightBlueColor table.Rows.Item(1)("RowHeaders").BackgroundColor = lightBlueColor ' Draw the table on canvas page1.Canvas.DrawTable (table), 20, 20 ' Save document to file pdfDocument.Save("result.pdf") ' Open document in default PDF viewer app Set shell = CreateObject("WScript.Shell") shell.Run "result.pdf", 1, false

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK 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 PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next