I hadn't seen that second one so wasn't familiar with the concept of the NormalFont BoldFont etc concept - that looks like it may well be what I need so will give it a try.
Set flds = FetchDocFields(lngType, lngSect, strUser, 1)
lngFont = objPDF.AddTrueTypeFont(doc.FontName, 0)
lngRes = objPDF.SelectFont(lngFont)
'set to default for the table
lngRes = objPDF.SetHTMLNormalFont("Default", lngFont)
'how many rows?
For Each fld In flds
If fld.FieldType = FieldType.Table Then 'table level settings
colms = fld.DrawOptions
strBordColour = fld.BorderColour
dblBordWidth = fld.BorderWidth
End If
If fld.FieldType = FieldType.TableRow Then
rows = rows + 1
End If
Next
'create the table skeleton
lngTable = objPDF.CreateTable(rows, colms)
'Specify color and width of table borders
If strBordColour <> "" Then
lngRes = objPDF.SetTableBorderColor(lngTable, 0, GetColourRGB(strBordColour, 0), GetColourRGB(strBordColour, 1), GetColourRGB(strBordColour, 2))
lngRes = objPDF.SetTableThinBorders(lngTable, 1, GetColourRGB(strBordColour, 0), GetColourRGB(strBordColour, 1), GetColourRGB(strBordColour, 2))
End If
If dblBordWidth > 0 Then
lngRes = objPDF.SetTableBorderWidth(lngTable, 0, dblBordWidth)
End If
'Specify table row height
lngRes = objPDF.SetTableRowHeight(lngTable, 1, rows, 0)
For Each fld In flds
Select Case fld.FieldType
Case FieldType.TableRow
'resest
row = row + 1
ColM = 1
If fld.Height > 0 Then
'Specify row height
lngRes = objPDF.SetTableRowHeight(lngTable, row, row, fld.Height)
End If
Case FieldType.TableCell
'render cell
'width
lngRes = objPDF.SetTableColumnWidth(lngTable, ColM, ColM, fld.Width)
'alignment
lngRes = objPDF.SetTableCellAlignment(lngTable, 1, ColM, row, ColM, fld.Alignment)
'Font Size
If fld.FontSize > 0 Then
lngRes = objPDF.SetTableCellTextSize(lngTable, row, ColM, row, ColM, fld.FontSize)
End If
'Border Colour
If fld.BorderColour <> "" Then
lngRes = objPDF.SetTableCellBorderColor(lngTable, row, ColM, row, ColM, 0, fld.BorderColourRGB(0), fld.BorderColourRGB(1), fld.BorderColourRGB(2))
End If
'border width
If fld.BorderWidth > 0 Then
lngRes = objPDF.SetTableCellBorderWidth(lngTable, row, ColM, row, ColM, 0, fld.BorderWidth)
End If
'background fill
If fld.BackgroundColour <> "" Then
lngRes = objPDF.SetTableCellBackgroundColor(lngTable, row, ColM, row, ColM, fld.BackgroundColourRGB(0), fld.BackgroundColourRGB(1), fld.BackgroundColourRGB(2))
End If
'forecolour
If fld.Colour <> "" Then
lngRes = objPDF.SetTableCellTextColor(lngTable, row, ColM, row, ColM, fld.ColourRGB(0), fld.ColourRGB(1), fld.ColourRGB(2))
End If
'padding
If fld.Padding > 0 Then
lngRes = objPDF.SetTableCellPadding(lngTable, row, ColM, row, ColM, 0, fld.Padding)
Else
If fld.PadLeft > 0 Then
lngRes = objPDF.SetTableCellPadding(lngTable, row, ColM, row, ColM, 1, fld.PadLeft)
End If
If fld.PadTop > 0 Then
lngRes = objPDF.SetTableCellPadding(lngTable, row, ColM, row, ColM, 2, fld.PadTop)
End If
If fld.PadRight > 0 Then
lngRes = objPDF.SetTableCellPadding(lngTable, row, ColM, row, ColM, 3, fld.PadRight)
End If
If fld.PadBottom > 0 Then
lngRes = objPDF.SetTableCellPadding(lngTable, row, ColM, row, ColM, 4, fld.PadBottom)
End If
End If
'put the actual content in
lngRes = objPDF.SetTableCellContent(lngTable, row, ColM, fld.FixedValue)
ColM = ColM + 1 'increment column counter
End Select
Next
'Draw the table onto the document
lngRes = objPDF.DrawTableRows(lngTable, lngXPos, lngYPos, 400, 1, 0)