//在线等待
//以下是具体实现的过程代码,
//但运行时它提示错误:Incompatible types: 'TCustomDBGridEh' and 'TFileName'
//请各位帮忙看下,非常感谢
procedure TfrmDataParent.btnOutputClick(Sender: TObject);
var
ExpClass:TDBGridEhExportClass;
Ext:String;
begin //从DBGridEh导出数据到.XLS文件或者HTM文件
screen.Cursor:=Crhourglass;
dlgSave.FileName:='newfile';
if dlgSave.Execute then
begin
if dlgSave.FilterIndex=1 then
begin
ExpClass := TDBGridEhExportAsXLS;
Ext:='xls';
end
else
if dlgSave.FilterIndex=2 then
begin
ExpClass := TDBGridEhExportAsHTML;
Ext:='htm';
end;
dlgSave.FileName := dlgSave.FileName+'.'+ Ext;
SaveDBGridEhToExportFile(ExpClass,dlgSave.FileName,True);
end;
screen.Cursor:=CrDefault;
end;
//在线等待
//以下是具体实现的过程代码,
//但运行时它提示错误:Incompatible types: 'TCustomDBGridEh' and 'TFileName'
//请各位帮忙看下,非常感谢
procedure TfrmDataParent.btnOutputClick(Sender: TObject);
var
ExpClass:TDBGridEhExportClass;
Ext:String;
begin //从DBGridEh导出数据到.XLS文件或者HTM文件
screen.Cursor:=Crhourglass;
dlgSave.FileName:='newfile';
if dlgSave.Execute then
begin
if dlgSave.FilterIndex=1 then
begin
ExpClass := TDBGridEhExportAsXLS;
Ext:='xls';
end
else
if dlgSave.FilterIndex=2 then
begin
ExpClass := TDBGridEhExportAsHTML;
Ext:='htm';
end;
dlgSave.FileName := dlgSave.FileName+'.'+ Ext;
SaveDBGridEhToExportFile(ExpClass,dlgSave.FileName,True);
end;
screen.Cursor:=CrDefault;
end;
//在线等待
摘要:Modify By 角落的青苔@2005/05/13 说明:增加导出过程中的回调功能(用户停止,进度条) 是否在第一行插入FieldName 改错:以前只能对word类型数值写入,DWord会Range Check error;已修正,见CellInteger //这个单元原来的Col和Row刚好弄反了(已修正):-( 增加导出分页的功能,因为xls单页不能超过 65536 行 (全文共37739字)
ExportClass parameter is one of the next classes:
TDBGridEhExportAsText, TDBGridEhExportAsCsv, TDBGridEhExportAsHTML, TDBGridEhExportAsRTF, TDBGridEhExportAsVCLDBIF or TDBGridEhExportAsXLS.
IsSaveAll parameter indicates whether to export whole grid or only selection.EhLib Software
很感谢你的答复,可惜那边内容太多,本人技术又有限,看不懂。