Sub File_Export
Dim myTextReader As TextReader
Dim components() As String
Dim XLAddress1 As XLAddress
Dim component_index As Int = 0
ProgressBar1.Progress = 0
XL.Initialize
XLAddress1.Initialize
Dim Workbook As XLWorkbookWriter = XL.CreateWriterBlank
Dim sheet1 As XLSheetWriter = Workbook.CreateSheetWriterByName("Sheet1")
Dim TitleStyle As XLStyle = Workbook.CreateStyle
TitleStyle.ForegroundColor(XL.COLOR_GREY_80_PERCENT).FontBoldColor(12, XL.COLOR_WHITE).HorizontalAlignment("CENTER")
Try
myTextReader.Initialize(File.OpenInput(SourceFileFolder, SourceFileName) )
Dim LineCounter As Int = 0
Dim line As String = "0"
Do While line <> Null
line = myTextReader.ReadLine
Try
If(line <> Null) Then
components = Regex.Split("\t",line)
End If
Catch
Log(LastException)
End Try
If(line <> Null) Then
If(components.Length > 0) Then
component_index = 0
For Each data_string In components
XLAddress1.Col0Based = component_index
XLAddress1.Row0Based = LineCounter
sheet1.PutString(XLAddress1, data_string)
component_index = component_index + 1
Next
End If
End If
ProgressBar1.Progress = LineCounter / TotalLineCounter
LineCounter = LineCounter + 1
Sleep(0) ' <----------------------------- Sleep(0) is here
Loop
myTextReader.Close
Catch
Log("Error --> " & LastException.Message)
If myTextReader.IsInitialized Then
myTextReader.Close
End If
End Try
'save the workbook
Dim f As String = Workbook.SaveAs(File.DirApp, "Products.xlsx", True)
Wait For (XL.OpenExcel(f)) Complete (Success As Boolean)
' StopMessageLoop 'non-ui
End Sub