DBGridEh导出
procedure ExportGridEh(DBGridEh:TDBGridEh);
var
ExpClass:TDBGridEhExportClass;
Ext:String;
dlgsave:TSaveDialog;
begin
dlgsave:= TSaveDialog.Create(nil);
begin
dlgsave.Filter:=‘Microsoft Excel|*.xls|CSV (Comma delimited)|*.csv|Text|*.txt|Web‘ +
‘ Page|*.htm|Rich Text Format(RTF)|*.rft‘;
if not dlgsave.Execute then Exit;
case dlgsave.FilterIndex of
1: begin ExpClass := TDBGridEhExportAsXLS; Ext := ‘xls‘; end;
2: begin ExpClass := TDBGridEhExportAsCSV; Ext := ‘csv‘; end;
3: begin ExpClass := TDBGridEhExportAsText; Ext := ‘txt‘; end;
4: begin ExpClass := TDBGridEhExportAsHTML; Ext := ‘htm‘; end;
5: begin ExpClass := TDBGridEhExportAsRTF; Ext := ‘rtf‘; end;
else
ExpClass := nil; Ext := ‘‘;
end;
if ExpClass <> nil then
begin
if UpperCase(Copy(dlgsave.FileName,Length(dlgsave.FileName)-2,3)) <> UpperCase(Ext) then
dlgsave.FileName := dlgsave.FileName + ‘.‘ + Ext;
SaveDBGridEhToExportFile(ExpClass,DBGridEh,dlgsave.FileName,true);
end;
end;
end;
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。