ByteScout Barcode Suite - VB.NET - Import from datatable with spreadsheet sdk - ByteScout

ByteScout Barcode Suite – VB.NET – Import from datatable with spreadsheet sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Suite – VB.NET – Import from datatable with spreadsheet sdk

How to import from datatable with spreadsheet sdk in VB.NET using ByteScout Barcode Suite

Learning is essential in computer world and the tutorial below will demonstrate how to import from datatable with spreadsheet sdk in VB.NET

We made thousands of pre-made source code pieces for easy implementation in your own programming projects. ByteScout Barcode Suite is the set that includes three different SDK products to generate barcodes, read barcodes and read and write spreadsheets: Barcode SDK, Barcode Reader SDK and Spreadsheet SDK. It can import from datatable with spreadsheet sdk in VB.NET.

The SDK samples given below describe how to quickly make your application do import from datatable with spreadsheet sdk in VB.NET with the help of ByteScout Barcode Suite. 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 Barcode Suite from our website to see and try many others 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)

Module1.vb
      
Imports System.IO Module Module1 Sub Main() Const fileName As String = "VBNetImportFromDataTable.xls" 'Create a new spreadsheet Dim spreadsheet As Bytescout.Spreadsheet.Spreadsheet = New Bytescout.Spreadsheet.Spreadsheet 'Get the data from the 2D array that we want to import Dim periodicTable As DataTable = GetDataTable() 'Import data into spreadheet spreadsheet.ImportFromDataTable(periodicTable) 'Insert row with column captions Dim worksheet As Worksheet = spreadsheet.Worksheets(0) worksheet.Rows.Insert(0) For colIndex As Integer = 0 To periodicTable.Columns.Count - 1 worksheet.Cell(0, colIndex).Value = periodicTable.Columns(colIndex).Caption Next 'Save the spreadsheet If (File.Exists(fileName)) Then File.Delete(fileName) End If spreadsheet.SaveAs(fileName) 'Close spreadsheet spreadsheet.Close() 'Open the spreadsheet Process.Start(fileName) End Sub ''' <summary> ''' Creates a data table of the periodic table of elements ''' </summary> ''' <returns>A data table of the periodic table of elements</returns> Function GetDataTable() As DataTable Dim periodicTable = New DataTable("PeriodicTable") Dim dr As DataRow periodicTable.Columns.Add("Name", GetType(String)) periodicTable.Columns.Add("Symbol", GetType(String)) periodicTable.Columns.Add("AtomicNumber", GetType(Integer)) dr = periodicTable.Rows.Add() dr(0) = "Hydrogen" dr(1) = "H" dr(2) = "1" dr = periodicTable.Rows.Add() dr(0) = "Helium" dr(1) = "He" dr(2) = "2" dr = periodicTable.Rows.Add() dr(0) = "Lithium" dr(1) = "Li" dr(2) = "3" dr = periodicTable.Rows.Add() dr(0) = "Beryllium" dr(1) = "Be" dr(2) = "4" dr = periodicTable.Rows.Add() dr(0) = "Boron" dr(1) = "B" dr(2) = "5" dr = periodicTable.Rows.Add() dr(0) = "Carbon" dr(1) = "C" dr(2) = "6" Return periodicTable End Function End Module

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode 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 Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next