procedure TForm1.Button1Click(Sender: TObject);var F:TextFile; DataSet:TDataSet; I:Integer;begin if not SaveDialog1.Execute then exit; if DBGrid1.DataSource.DataSet.State<>dsBrowse then Exit; AssignFile(F, SaveDialog1.FileName); Rewrite(F); For I:=0 To DBGrid1.Columns.Count-1 do if DBGrid1.Columns.Field<>nil then Write(F, DBGrid1.Columns.Title.Caption+chr(9)); DBGrid1.DataSource.DataSet.First; While not DBGrid1.DataSource.DataSet.Eof do begin WriteLn(F); For I:=0 To DBGrid1.Columns.Count-1 do if DBGrid1.Columns.Field<>nil then begin if DBGrid1.Columns.Field.DataType in [ftString,ftFixedChar, ftWideString] then Write(F, ''''+DBGrid1.Columns.Field.DisplayText+Chr(9) ) else write(F, DBGrid1.Columns.Field.DisplayText+Chr(9) ); end; DBGrid1.DataSource.DataSet.Next; end; CloseFile(F);end;这种写法比操作excell,速度要快10倍以上。