
Sub EmitHTMLTableHeader (FileNum As Integer, 
    BorderWidth As Integer, CellPadding As Integer)

  ' Generate HTML table opening tag, using passed file number.
  ' Call with BorderWidth = 0 for no border, -1 for default border,
  ' or positive value for explicit border width. Cell padding
  ' can also be specified by caller as a zero value (for default
  ' padding) or positive value (for explicit padding width).

  Dim S1 As String

  ' create the opening portion of the TABLE tag
  S1 = "<TABLE "

  ' if any border was requested, include the border modifier
  If BorderWidth <> 0 Then
    S1 = S1 & "BORDER "
  End If

  ' if non-default border was requested, include CELLSPACING modifier
  If BorderWidth > 0 Then
    S1 = S1 & "CELLSPACING=" & Chr$(34) & LTrim$(Str$(BorderWidth)) & Chr$(34)
  End If

  ' if non-default padding was requested, include CELLPADDING modifier
  If CellPadding > 0 Then
    S1 = S1 & "CELLPADDING=" & Chr$(34) & LTrim$(Str$(CellPadding)) & Chr$(34)
  End If

  ' close out the TABLE tag and write it to the disk file
  S1 = S1 & ">"
  Print #FileNum, S1

End Sub


Sub EmitHTMLTableRow (FileNum As Integer, 
    ColumnCount As Integer, ColumnData() As String)

  ' This routine is called with a file number, a string array,
  ' and a count of items to generate the HTML code for a single
  ' row of an HTML table.

  Dim X As Integer

  ' Emit HTML tag to start the table row
  Print #FileNum, "<TR> ";

  ' Emit HTML tags & string data for a single cell
  For X = 1 To ColumnCount
     Print #FileNum, "<TD>";
     Print #FileNum, ColumnData(X);
     Print #FileNum, "</TD> ";
  Next X

  ' Emit HTML tag to end the table row
  Print #FileNum, "</TR>"

End Sub


Sub EmitHTMLTableTrailer (FileNum As Integer)

  ' write the closing table tag to the specified file number
  Print #FileNum, "</TABLE>"

End Sub
