TcxGrid导出EXCEL
ExportGrid4ToEXCEL这个老的版本用的,新的版本引用cxGridExportLink这个单元。
function ExportExcel(grid: TcxGrid; const fileName: string = '1.xls'): Boolean;
var
sd: TSaveDialog;
begin
Result := False;
if not Assigned(grid) then
Exit;
sd := TSaveDialog.Create(nil);
try
sd.Filter := '*.xls|*.xls';
sd.fileName := fileName;
if sd.Execute then
begin
Screen.Cursor := crSQLWait;
try
ExportGridToExcel(sd.fileName, grid);
finally
Screen.Cursor := crDefault;
end;
Result := True;
end;
finally
sd.Free;
end;
end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/4888270.html