我刚写了一个供你参考:
...
SS:=TStringList.Create;
I:=ADOTable1.RecordCount;
J:=1;
For H:=1 to I do
begin
IF Trim(ADOTable1.Fields[2].AsString)='你的判断条件'then
begin
SS.Add('<tr><td width="49" height="26">'+inttostr(J)
+'</td><td width="106" height="26">'+ADOTable1.Fields[0].AsString
+'</td><td width="75" height="26">'+ADOTable1.Fields[1].AsString
+'</td><td width="275" height="26">'+ADOTable1.Fields[2].AsString
+'</td><td width="44" height="26">'+ADOTable1.Fields[3].AsString
+'</td><td width="41" height="26">'+ADOTable1.Fields[4].AsString
+'</td><td width="43" height="26">'+ADOTable1.Fields[5].AsString+'</td></tr>');
J:=J+1;
end;
ADOTable1.Next;
end;
ss.SaveToFile('N.txt');