Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
- Dim OutputHTML : Set OutputHTML = fso.CreateTextFile("C:\Users\jmwal\Desktop\data.html")
- Dim file : Set file = fso.OpenTextFile("C:\Users\jmwal\Desktop\data.txt", 1, True)
- Dim fc : fc = file.ReadAll : file.close : Dim fcArray : fcArray = Split(fc, vbCrLf)
- REM Rebuild Array
- Dim opArray() : ReDim opArray(0)
- For Each row In fcArray
- Dim tmp: tmp = Split(row, "|")
- For ent=0 To UBound(tmp)
- If ent > UBound(opArray) Then
- ReDim Preserve opArray(UBound(opArray)+1)
- opArray(ent) = Trim(tmp(ent))
- Else
- If Len(opArray(ent)) > 0 Then
- 'OutputHTML.WriteLine "<tr>"
- opArray(ent) = opArray(ent) & " " & Trim(tmp(ent))
- ' OutputHTML.WriteLine "</tr>"
- Else
- opArray(ent) = Trim(tmp(ent))
- End If
- End If
- Next
- Next
- REM Echo
- 'WScript.echo Join(opArray, vbCrLf)
- REM What does opArray look like
- 'For Each item in opArray
- 'WScript.echo item
- 'Next
- REM report opArray in HTML
- OutputHTML.WriteLine "<html>"
- OutputHTML.Writeline "<body>"
- OutputHTML.WriteLine "<table BORDER=1>"
- For Each row in opArray
- OutputHTML.WriteLine "<tr>"
- For Each col in Split(row, " ")
- OutputHTML.Write "<td>" + col + "</td>"
- Next
- OutputHTML.WriteLine "</tr>"
- Next
- OutputHTML.WriteLine "</table>"
- OutputHTML.WriteLine "</body>"
- OutputHTML.WriteLine "</html>"
- OutputHTML.Close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement