RosettaCodeData/Task/Create-an-HTML-table/PureBasic/create-an-html-table-1.basic

41 lines
937 B
Plaintext

Title.s="Create an HTML table"
head.s=""
head.s+"<html><head><title>"+Title.s+"</title></head><body>"+chr(13)+chr(10)
tablehead.s
tablehead.s+"<table border=1 cellpadding=10 cellspacing=0>"+chr(13)+chr(10)
tablehead.s+"<tr><th></th><th>X</th><th>Y</th><th>Z</th></tr>"+chr(13)+chr(10)
index=0
tablebody.s=""
for row=1 to 4
index+1
tablebody.s+"<tr><th>"+str(index)+"</th>"
for col=1 to 3
tablebody.s+"<td align="+chr(34)+"right"+chr(34)+">"+str(Random(9999,1))+"</td>"
next
tablebody.s+"</tr>"+chr(13)+chr(10)
next
tablefoot.s=""
tablefoot.s+"</table>"+chr(13)+chr(10)
foot.s=""
foot.s+"</body></html>"+chr(13)+chr(10)
FileName.s="Create_an_HTML_table.html"
If CreateFile(0,FileName.s)
WriteString(0,head.s)
WriteString(0,tablehead.s)
WriteString(0,tablebody.s)
WriteString(0,tablefoot.s)
WriteString(0,foot.s)
CloseFile(0)
Else
Debug "Not WriteString :"+FileName.s
EndIf
; RunProgram(FileName.s)