HelloWorldVB

 
Imports GemBox.Spreadsheet

Module HelloWorldVB

    Sub Main()
        ' TODO: If using GemBox.Spreadsheet Professional, put your serial key below.
        ' Otherwise, if you are using GemBox.Spreadsheet Free, comment out the 
        ' following line (Free version doesn't have SetLicense method). 
        ' SpreadsheetInfo.SetLicense("YOUR-SERIAL-KEY-HERE")

        Dim excelFile As New ExcelFile
        Dim ws As ExcelWorksheet = excelFile.Worksheets.Add("HelloWorldVB")

        ws.Cells(0, 0).Value = "English:"
        ws.Cells(0, 1).Value = "Hello"

        ws.Cells(1, 0).Value = "Russian:"
        ' Using UNICODE string.
        ws.Cells(1, 1).Value = New String(New Char() {ChrW(&H417), ChrW(&H434), ChrW(&H440), ChrW(&H430), ChrW(&H432), ChrW(&H441), ChrW(&H442), ChrW(&H432), ChrW(&H443), ChrW(&H439), ChrW(&H442), ChrW(&H435)})

        ws.Cells(2, 0).Value = "Chinese:"
        ' Using UNICODE string.
        ws.Cells(2, 1).Value = New String(New Char() {ChrW(&H4F60), ChrW(&H597D)})

        ws.Cells("A5").Value = "In order to see Russian and Chinese characters you need to have appropriate fonts on your machine."

        Dim fileName As String = "HelloWorldVB.xls"
        excelFile.SaveXls(fileName)
        ' Uncomment if you want to export in XLSX.
        'Dim fileName As String = "HelloWorldVB.xlsx"
        'excelFile.SaveXlsx(fileName)

        TryToDisplayGeneratedFile(fileName)
    End Sub

    Sub TryToDisplayGeneratedFile(ByVal fileName As String)
        Try
            System.Diagnostics.Process.Start(fileName)
        Catch
            Console.WriteLine(fileName + " created in application folder.")
        End Try
    End Sub

End Module

 

GemBox.Spreadsheet - C# and VB NET Write Excel Component