Source code documentation samples provide quick and easy way to add a required functionality into your application. ByteScout Spreadsheet SDK was made to help with number format in cells in VB.NET. ByteScout Spreadsheet SDK is the SDK to create, read, modify and calculate spreadsheets. Formula calculations are supported, import and export to and from JSON, CSV, XML, databases, arrays.
VB.NET code snippet like this for ByteScout Spreadsheet SDK works best when you need to quickly implement number format in cells in your VB.NET application. In order to implement this functionality, you should copy and paste code below into your app using code editor. Then compile and run your application. Enjoy writing a code with ready-to-use sample VB.NET codes to add number format in cells functions using ByteScout Spreadsheet SDK in VB.NET.
Trial version can be downloaded from our website. Source code samples for VB.NET and documentation are included.
Imports Bytescout.Spreadsheet Imports System.IO Imports System.Diagnostics Module Module1 Sub Main() ' Create new Spreadsheet Dim document As New Spreadsheet() ' Get worksheet by name Dim worksheet As Worksheet = document.Workbook.Worksheets.Add("Sample") ' Set header worksheet.Cell(0, 0).Value = "Number" worksheet.Cell(0, 1).Value = "Format" ' Set variables Dim plan As Double = 3000 Dim result As Double = 3100 ' Fill cells For i As Integer = 1 To 5 worksheet.Cell(i, 0).Value = result / plan Next ' Set cells format worksheet.Cell(1, 0).NumberFormatString = "0.00" worksheet.Cell(2, 0).NumberFormatString = "0.00%" worksheet.Cell(3, 0).NumberFormatString = "mm:ss" worksheet.Cell(4, 0).NumberFormatString = "hh:mm:ss" worksheet.Cell(5, 0).NumberFormatString = "##0,0E+0" ' Set captions worksheet.Cell(1, 1).Value = "0.00" worksheet.Cell(2, 1).Value = "0.00%" worksheet.Cell(3, 1).Value = "mm:ss" worksheet.Cell(4, 1).Value = "hh:mm:ss" worksheet.Cell(5, 1).Value = "##0,0E+0" ' remove output file if already exists If File.Exists("Output.xls") Then File.Delete("Output.xls") End If ' Save document document.SaveAs("Output.xls") ' Close Spreadsheet document.Close() ' open in default spreadsheets viewer/editor Process.Start("Output.xls") End Sub End Module