A
admin2008
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure export_data(DBGridEH:TDBGridEH); //数据导出
var ExpClass:TDBGridEhExportClass;
SaveDialog:TSaveDialog;
Extchar;
begin
CoInitialize(nil);
SaveDialog:=TSaveDialog.Create(nil);
SaveDialog.FileName := '导出文件名';
saveDialog.Filter := 'Text files (*.txt)|*.TXT';
if SaveDialog.Execute then
begin
case SaveDialog.FilterIndex of
1: begin ExpClass := TDBGridEhExportAsText; Ext := 'txt'; end;
else
ExpClass := nil; Ext := '';
end;
if ExpClass <> nil then
begin
if UpperCase(Copy(SaveDialog.FileName,Length(SaveDialog.FileName)-2,3)) <>UpperCase(Ext) then
SaveDialog.FileName := SaveDialog.FileName + '.' + Ext;
SaveDBGridEhToExportFile(ExpClass,DBGridEh,SaveDialog.FileName,true);
end;
end;
SaveDialog.Free ;
CoInitialize(nil);
end;
这段代码写在dll里然后调用 打开保存窗口 当点保存按钮时就出现这样的错误:cannot assingn a tfont to a tfont
望兄弟们支招 谢了!
var ExpClass:TDBGridEhExportClass;
SaveDialog:TSaveDialog;
Extchar;
begin
CoInitialize(nil);
SaveDialog:=TSaveDialog.Create(nil);
SaveDialog.FileName := '导出文件名';
saveDialog.Filter := 'Text files (*.txt)|*.TXT';
if SaveDialog.Execute then
begin
case SaveDialog.FilterIndex of
1: begin ExpClass := TDBGridEhExportAsText; Ext := 'txt'; end;
else
ExpClass := nil; Ext := '';
end;
if ExpClass <> nil then
begin
if UpperCase(Copy(SaveDialog.FileName,Length(SaveDialog.FileName)-2,3)) <>UpperCase(Ext) then
SaveDialog.FileName := SaveDialog.FileName + '.' + Ext;
SaveDBGridEhToExportFile(ExpClass,DBGridEh,SaveDialog.FileName,true);
end;
end;
SaveDialog.Free ;
CoInitialize(nil);
end;
这段代码写在dll里然后调用 打开保存窗口 当点保存按钮时就出现这样的错误:cannot assingn a tfont to a tfont
望兄弟们支招 谢了!