关于grid数据导出到excel表格的效率的问题?
写了个函数导出到excel,不过是一条一条通过cell单元格控制的,不是很高效.
请问有没有其他的方法?
就像excel,access导入,导出数据,感觉就不是一条一条遍历的.procedure TForm1.Button1Click(Sender: TObject);
var
ExcelApp : Variant; 
RecordCounts : Integer;
i:Integer;
begin
  try
    ExcelApp := CreateOleObject('Excel.Application'); 
  Excel.Application
  except
    ShowMessage('±¾»úûÓа²×°EXCEL£¡');
    exit;
  end;
  ExcelApp.WorkBooks.Add;
  ExcelApp.WorkSheets[1].Activate; 
  adoQuery1.Close;
  adoQuery1.Open;
  adoQuery1.First;
  ExcelApp.Cells[1,1].value :='Name';
  ExcelApp.Cells[1,2].value :='Area';
  RecordCounts := adoQuery1.RecordCount; 
  for i:=2 to RecordCounts+1 do
  begin
    if not adoQuery1.Eof then
    begin
      ExcelApp.Cells[i,1].Value :=adoQuery1.FieldByName('name').AsString;
      ExcelApp.Cells[i,2].Value :=adoQuery1.FieldByName('area').AsString;
      adoQuery1.Next;
    end;
  end;
  ExcelApp.ActiveWorkBook.SaveAs('c:\list.xls');
  if MessageDlg('Îļþ c:\list.xls ±£´æ³É¹¦£¬ÊÇ·ñÒª´ò¿ª±à¼­´ËÎļþ£¿',mtConfirmation,[mbYes,mbNo,mbCancel],0)= mrYes then
    ExcelApp.Visible := True 
  else
  begin
    ExcelApp.Visible := False;
    ExcelApp.Quit;
  end;
end;