A
admin2008
Unregistered / Unconfirmed
GUEST, unregistred user!
就是我把dbgrideh的数据导出来 这是代码有错 提示GrdBabyNum 没有定义 请问这段代码应怎么改下呢
procedure Tyaopinzd.SpeedButton6Click(Sender: TObject); //导出
var
ExpClass:TDBGridEhExportClass;//保存文件的地址
Ext:String;//用于判断保存文件的类型
begin
SaveDialog1.FileName := 'file1';//文件名称
if SaveDialog1.Execute then
begin
case SaveDialog1.FilterIndex of
1: begin ExpClass := TDBGridEhExportAsText; Ext := 'txt'; end;
2: begin ExpClass := TDBGridEhExportAsCSV; Ext := 'csv'; end;
3: begin ExpClass := TDBGridEhExportAsHTML; Ext := 'htm'; end;
4: begin ExpClass := TDBGridEhExportAsRTF; Ext := 'rtf'; end;
5: begin ExpClass := TDBGridEhExportAsXLS; 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;
showmessage('导出数据成功!');
SaveDBGridEhToExportFile(ExpClass,GrdBabyNum,SaveDialog1.FileName,True);//导出数据
//其中false为局部数据
end;
end;
end;
procedure Tyaopinzd.SpeedButton6Click(Sender: TObject); //导出
var
ExpClass:TDBGridEhExportClass;//保存文件的地址
Ext:String;//用于判断保存文件的类型
begin
SaveDialog1.FileName := 'file1';//文件名称
if SaveDialog1.Execute then
begin
case SaveDialog1.FilterIndex of
1: begin ExpClass := TDBGridEhExportAsText; Ext := 'txt'; end;
2: begin ExpClass := TDBGridEhExportAsCSV; Ext := 'csv'; end;
3: begin ExpClass := TDBGridEhExportAsHTML; Ext := 'htm'; end;
4: begin ExpClass := TDBGridEhExportAsRTF; Ext := 'rtf'; end;
5: begin ExpClass := TDBGridEhExportAsXLS; 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;
showmessage('导出数据成功!');
SaveDBGridEhToExportFile(ExpClass,GrdBabyNum,SaveDialog1.FileName,True);//导出数据
//其中false为局部数据
end;
end;
end;