TcxDBTreeList导出EXCEL

uses cxTLExportLink, cxDBTL

 

function ExportExcel(tree: TcxDBTreeList;
  const fileName: string = '1.xls'): Boolean;
var
  sd: TSaveDialog;
begin
  Result := False;
  if not Assigned(tree) then
    Exit;
  sd := TSaveDialog.Create(nil);
  try
    sd.Filter := '*.xls|*.xls';
    sd.fileName := fileName;
    if sd.Execute then
    begin
      Screen.Cursor := crSQLWait;
      try
        cxExportTLToEXCEL(sd.fileName, tree, True, True);
      finally
        Screen.Cursor := crDefault;
      end;
      Result := True;
    end;
  finally
    sd.Free;
  end;
end;

posted @ 2015-10-17 21:16  delphi中间件  阅读(1164)  评论(0编辑  收藏  举报