The sample source code below will teach you how to add images in VB.NET. ByteScout Spreadsheet SDK can add images. It can be used from VB.NET. ByteScout Spreadsheet SDK is the SDK that can write and read, modify and calculate Excel and CSV spreadsheets. Most popular formulas are supported. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays.
You will save a lot of time on writing and testing code as you may just take the VB.NET code from ByteScout Spreadsheet SDK for add images below and use it in your application. In order to implement the functionality, you should copy and paste this code for VB.NET below into your code editor with your app, compile and run your application. Further enhancement of the code will make it more vigorous.
ByteScout free trial version is available for download from our website. It includes all these programming tutorials along with source code samples.
Imports System.Collections.Generic Imports System.Diagnostics Imports System.IO Imports System.Text Imports Bytescout.Spreadsheet Class Program Friend Shared Sub Main(args As String()) ' Create spreadsheet Dim doc As New Spreadsheet() ' Add worksheet Dim worksheet As Worksheet = doc.Worksheets.Add() ' Put an image on the worksheet with 10 pixel margin from the top-left corner of the worksheet worksheet.Pictures.Add("image1.jpg", 10, 10) ' Put second image to 200 pixel offset and resize it to 250x200 px worksheet.Pictures.Add("image2.jpg", 200, 200, 250, 200) ' Delete output file if exists If File.Exists("output.xls") Then File.Delete("output.xls") End If ' Save document doc.SaveAs("output.xls") ' Close spreadsheet doc.Close() ' Open generated XLS document in default application Process.Start("output.xls") doc.Dispose() End Sub End Class