Link Search Menu Expand Document

Getting Started in Visual Basic .NET

The following example demonstrates usage of Spreadsheet class.

Imports Bytescout.Spreadsheet
Imports System.IO

Module Module1

    Sub Main()
        Dim document As New Spreadsheet()

        Dim worksheet As Worksheet = document.Workbook.Worksheets.Add("HelloWorld")

        worksheet.Cell(0, 0).Value = "Hello, World!"

        ' 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

Copyright © 2016 - 2021 ByteScout