
To export to a file
------------------------------------------------------

ExpGrid1.ExpSaveToFile; 


To copy all data from DBGrid
-------------------------------------------------------

ExpGrid1.ExpCopyToClipboard;  



====================================================================
Here is a more agressive example, which shows how to tweak which
columns are to be used, the column sizes:

procedure Form1.ExportDBGridToFileClick(Sender: TObject);

begin
  Screen.cursor:= crHourGlass;
  DBGrid1.Datasource.Dataset.DisableControls;


  { tweak column sizes }
  DBGrid1.Fields[0].DisplayWidth:=4;  
  DBGrid1.Fields[1].DisplayWidth:=38; 
  DBGrid1.Fields[2].DisplayWidth:=3;  
  DBGrid1.Fields[3].DisplayWidth:=3;  
  DBGrid1.Fields[4].DisplayWidth:=9;  


  { don't save this field }
  DBGrid1.Fields[5].visible:=false; 

  { We'll use the form's caption as the name of the report }
  ExpGrid1.ExpTitle := Caption;  
  ExpGrid1.ExpTitleAlignment:=taCenter; 

  {Add number column to file (replace first data column)}
  ExpGrid1.ExpNrColumn:=true;

  ExpGrid1.ExpSaveToFile;

  DBGrid1.Fields[5].visible:=true; 

  DBGrid1.Datasource.Dataset.EnableControls;
  Screen.cursor:= crDefault;
end;
