Sign in to follow this  
Followers 0
minjin

I need help with this script

6 posts in this topic

Hi everyone,

i need to read a file, sort this list and then output the whole as a plain html table. I have this so far:

#include <array.au3>
#include <file.au3>

$sEingabe = @ScriptDir & "\test.csv"
$sAusgabe = @ScriptDir & "\table.html"

LogSortieren($sEingabe, $sAusgabe)
Exit

Func LogSortieren($sEingabe, $sAusgabe)
    Dim $aDaten
    ;Einlesen
    _FileReadToArray($sEingabe, $aDaten)
    ;Array sortieren
    _ArraySort($aDaten, 0, 1)
    ;_ArrayDisplay($aDaten)
    ;schreiben
    _FileWriteFromArray($sAusgabe, $aDaten, 1)
EndFunc   ;==>LogSortieren

The only thing is missing is the output into a html table. Help will be really appreciated, thanks.

Share this post


Link to post
Share on other sites



; base example

FileWriteLine($sAusgabe, '<html><body><table border="1" width="600" height="100" align="center"><tr><td align="left">')

; Insert your data here

FileWriteLine($sAusgabe, '</td></tr></table></body></html>')


Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

this seems not to work..

Share this post


Link to post
Share on other sites

Ich hoffe, das hilft

#include <Array.au3>
#include <File.au3>

$out = @ScriptDir & "\test.html"
Dim $lines
_FileReadToArray(@ScriptDir & "\test.csv", $lines)
For $i = 1 To $lines[0]
    If $i = 1 Then
        FileWriteLine($out, '<table border="1"><tr>')
        $cols = StringSplit($lines[$i], ",")
        For $j = 1 To $cols[0]
            FileWriteLine($out, "<th>" & $cols[$j] & "</th>")
        Next
        FileWriteLine($out, '</tr>')
    Else
        $cols = StringSplit($lines[$i], ",")
        FileWriteLine($out, '<tr>')
        For $j = 1 To $cols[0]
            FileWriteLine($out, "<td>" & $cols[$j] & "</td>")
        Next
    EndIf
    FileWriteLine($out, '</tr>')
Next
FileWriteLine($out, '</table>')
FileClose($out)

Share this post


Link to post
Share on other sites

Thanks yeah this did the work but its still an unclean table with @ signs.

Share this post


Link to post
Share on other sites

A forum search of CSV in the title, returned 96 results.

Heres a few to try...

CSV-Editor by funkey

_CSV_ToHTML by taietel


Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0