The coding tutorials are designed to help you test the features without need to write your own code. ByteScout Spreadsheet SDK is the SDK component for writing, reading, modifying and calculating Excel and CSV spreadsheets. Can calculate and reculculate formulas with Excel installed. You may import or export data to and from CSV, XML, JSON. Supports export to databases, arrays, streams and you can use it to convert template to XLS with VB.NET.
The SDK samples like this one below explain how to quickly make your application do convert template to XLS in VB.NET with the help of ByteScout Spreadsheet SDK. Just copy and paste the code into your VB.NET application’s code and follow the instruction. Test VB.NET sample code examples whether they respond your needs and requirements for the project.
Free trial version of ByteScout Spreadsheet SDK is available for download from our website. Get it to try other 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