看看代码:
ts:=tstringlist.create;
ts.Add('<html>');
ts.Add('<body>');
with Query1 do
if not IsEmpty then
begin
first;
ts.Add('<table>');
while not Eof do
begin
ts.Add('<tr>');
for i:=0 to Fields.Count-1 do
ts.add('<td>'+Fields.AsString+'</td>');
ts.add('</tr>');
Next;
end; //end of while
ts.Add('</table>');
end; //end of if not isempty
ts.Add('</body>');
ts.Add('</html>');
ts.savetofile('c:/htmlresult.html');