EXCEL导入导出的问题
适用EXCEl导出只能一条一条写EXCEL么?好慢,怎么快?
试下用这个:
use DBGridEhImpExp;
procedure TForm1.DBGridEh1DblClick(Sender: TObject);
var
ExpClass:TDBGridEhExportClass;
Ext:string;
begin
SaveDialog1.FileName := 'file1';
if (ActiveControl is TDBGridEh) then
if SaveDialog1.Execute then
begin
case SaveDialog1.FilterIndex of
1: begin ExpClass := TDBGridEhExportAsText; Ext := 'txt'; end;
2: begin ExpClass := TDBGridEhExportAsText; Ext := 'csv'; end;
3: begin ExpClass := TDBGridEhExportAsText; Ext := 'htm'; end;
4: begin ExpClass := TDBGridEhExportAsText; Ext := 'rtf'; end;
5: begin ExpClass := TDBGridEhExportAsText; Ext := 'xls'; end;
else
ExpClass := nil; Ext := '';
end;
if ExpClass <> nil then
begin
if UpperCase(Copy(SaveDialog1.FileName,Length(SaveDialog1.FileName)-2,3)) <> UpperCase(Ext) then
SaveDialog1.FileName := SaveDialog1.FileName + '.' +Ext;
SaveDBGridEhToExportFile(ExpClass,TDBGridEh(ActiveControl),SaveDialog1.FileName,True);
end;
end;
end;