ByteScout Spreadsheet SDK - VB.NET - Convert Template To XLS - ByteScout

ByteScout Spreadsheet SDK – VB.NET – Convert Template To XLS

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – VB.NET – Convert Template To XLS

How to convert template to XLS in VB.NET and ByteScout Spreadsheet SDK

How to convert template to XLS in VB.NET

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.

Try ByteScout Spreadsheet SDK today: Get 60 Day Free Trial or sign up for Web API

Program.vb
      
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

Try ByteScout Spreadsheet SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout Spreadsheet SDK page

Explore ByteScout Spreadsheet SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next