These sample source codes on this page below are displaying how to convert template to xls with spreadsheet sdk in VB.NET. What is ByteScout Barcode Suite? It 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 help you to convert template to xls with spreadsheet sdk in your VB.NET application.
This prolific sample source code in VB.NET for ByteScout Barcode Suite contains various functions and other necessary options you should do calling the API to convert template to xls with spreadsheet sdk. IF you want to implement the functionality, just copy and paste this code for VB.NET below into your code editor with your app, compile and run your application. Use of ByteScout Barcode Suite in VB.NET is also described in the documentation included along with the product.
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.
Imports System.Diagnostics Imports System.IO Imports Bytescout.Spreadsheet Class Program Friend Shared Sub Main(args As String()) ' Open spreadsheet from file Dim document As New Spreadsheet() document.LoadFromFile("template.xls") ' Get first worksheet Dim worksheet As Worksheet = document.Workbook.Worksheets(0) ' Find macros and replace them with values Replace(worksheet, "<PRODUCT_NAME1>", "Product 1", Nothing) Replace(worksheet, "<PRODUCT_NAME2>", "Product 2", Nothing) Replace(worksheet, "<PRICE1>", 24.99F, "0.00") Replace(worksheet, "<PRICE2>", 29.99F, "0.00") Replace(worksheet, "<QANTITY1>", 5, Nothing) Replace(worksheet, "<QANTITY2>", 10, Nothing) ' Delete output file if exists If File.Exists("output.xls") Then File.Delete("output.xls") End If ' Save document document.SaveAs("output.xls") ' Close spreadsheet document.Close() ' Open generated XLS document in default application Process.Start("output.xls") End Sub Private Shared Sub Replace(worksheet As Worksheet, macro As String, value As Object, format As String) Dim cell As Cell = worksheet.Find(macro, True, False, False) While cell IsNot Nothing cell.Value = value If Not [String].IsNullOrEmpty(format) Then cell.NumberFormatString = format End If cell = worksheet.FindNext() End While End Sub End Class