XlsxPreserveSamplesVB

Back to features

Imports System
 
Imports GemBox.Spreadsheet
 
Module XlsxPreserveSamplesVB
 
    Sub Main(ByVal args As String())
        ' 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 inputFileName As String = "..\..\PreserveSamplesIN.xlsm"
        Dim outputFileName As String = "..\..\PreserveSamplesOUT.xlsm"
 
        excelFile.LoadXlsx(inputFileName, XlsxOptions.PreserveKeepOpen)
 
        ' Preservation is fully functional only in xlsx.
        excelFile.SaveXlsx(outputFileName)
 
        TryToDisplayGeneratedFile(outputFileName)
    End Sub
 
    Sub TryToDisplayGeneratedFile(ByVal fileName As String)
        Try
            Process.Start(fileName)
        Catch exception1 As Exception
            Console.WriteLine((fileName & " created in application folder."))
        End Try
    End Sub
 
End Module