minjin Posted April 5, 2011 Share Posted April 5, 2011 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. Link to comment Share on other sites More sharing options...
ripdad Posted April 6, 2011 Share Posted April 6, 2011 ; 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>') "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
minjin Posted April 6, 2011 Author Share Posted April 6, 2011 this seems not to work.. Link to comment Share on other sites More sharing options...
smartee Posted April 6, 2011 Share Posted April 6, 2011 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) Link to comment Share on other sites More sharing options...
minjin Posted April 6, 2011 Author Share Posted April 6, 2011 Thanks yeah this did the work but its still an unclean table with @ signs. Link to comment Share on other sites More sharing options...
ripdad Posted April 6, 2011 Share Posted April 6, 2011 A forum search of CSV in the title, returned 96 results. Heres a few to try... CSV-Editor by funkey _CSV_ToHTML by taietel "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now