* test HTMLTagTable function - see TableExO.html for output
$include H
dim numbers(4)
numbers(1) = "One"
numbers(2) = "Two"
numbers(3) = "Three"
numbers(4) = "Four"
equate nRows to 4
equate nCols to 4
TableData = ""
for i = 1 to nRows
for j = 1 to nCols
TableData = numbers(i) : "," : numbers(j)
next j
next i
open "HTML.CAC" to html else stop "Error opening HTML.CAC"
prompt ""
HTMLOutput = "Test Tables"
* a simple table
HTMLOutput := "Simple 4x4 Table with border
"
HTMLOutput := @FM : HTMLTagTable("","",TableData)
* table with headers on rows and columns
HTMLOutput := "4x4 Table with row and column headers
"
Table = TableData
for i = 1 to nCols
Table<1,i> = "H":@SVM:Table<1,i>
next i
for i = 2 to nRows
Table = "H":@SVM:Table
next i
HTMLOutput := @FM : HTMLTagTable("4","",Table)
* column span in header
HTMLOutput := "Column span in first row header with Caption
"
Table = TableData
Table<1> = "H":@TM:@TM:@TM:@TM:3:@SVM:Table<1,1>:@VM:Table<1,4>
HTMLOutput := @FM : HTMLTagTable("1","Column Span",Table)
* column and row span in header
HTMLOutput := "Row span in header with Caption
"
Table = TableData
Table<1,1> = "H":@TM:@TM:@TM:@TM:@TM:2:@SVM:Table<1,1>
Table<2> = Table<2,2>:@VM:Table<2,3>:@VM:Table<2,4>
HTMLOutput := @FM : HTMLTagTable("1","Row Span":@FM:"TOP",Table)
* Alignment test
HTMLOutput := "4x4 Alignment test
"
Table = TableData
for i = 1 to nCols
Table<1,i> = "H":@SVM:Table<1,i>
next i
for i = 2 to nRows
Table = "H":@SVM:Table
next i
Table<2,2>=@TM:"LEFT":@SVM:"Left"
Table<4,4>=@TM:"RIGHT":@SVM:"Right"
HTMLOutput := @FM : HTMLTagTable("10":@FM:@FM:"12","",Table)
* table within a table
HTMLOutput := "Table within a table
"
Table = TableData
for i = 1 to nCols
Table<1,i> = "H":@SVM:Table<1,i>
next i
for i = 2 to nRows
Table = "H":@SVM:Table
next i
Table<3,3>=convert(@FM,"",HTMLTagTable("3","",TableData))
HTMLOutput := @FM : HTMLTagTable("10":@FM:0:@FM:"4","",Table)
HTMLOutput := ""
write HTMLOutput to html, "TESTTBL.HTM"
stop "Done..."
end