* ... loDocument = loForm.htmlviewer.Object.Document loTables = loDocument.getElementsByTagName('TABLE') lcCodes = '' For ix = 0 To loTables.Length-1 lcCodes = m.lcCodes + Chr(13)+Chr(10)+; this.ReadTemplates(loTables.Item(m.ix), loTables.Item(m.ix).Id) Endfor Return m.lcCodes Endproc Procedure ReadTemplates(toTable, m.tcProcName) Local lcCode, loRows, loRow, iRows, iCells, oAttr, loCells, ix,jx,loCaption Set Textmerge To Memvar m.lcCode Noshow Set Textmerge On loRows = toTable.getElementsByTagName('TR') If loRows.Length > 0 \ \procedure <<m.tcProcName>> \lparameters toDocument, toBody, oRow For iRows = 0 To loRows.Length-1 loRow = loRows.Item(m.iRows) \local loRow,loCell \loRow = toDocument.createElement('TR') oAttr = loRow.Attributes For ix = 0 To oAttr.Length-1 If oAttr.Item(m.ix).specified \loRow.<<oAttr.item(m.ix).name>> = "<<oAttr.item(m.ix).nodeValue>>" Endif Endfor loCells = loRow.getElementsByTagName('TD') *...What it does is to read template HTML fragments and create code that would transform actual data into HTML dynamically on the fly (reads and writes the 'writer'). IOW VFP style XSLT (I could never feel comfortable with XSL transformation languages).