CXGRID 导出EXCEL

USES 
cxgridExportlink
procedure TfrmAdvAPS.CxGridToExcel(AcxGrid: TcxGrid);
var
  SaveDialog: TSaveDialog;
begin
  SaveDialog := TSaveDialog.Create(nil);
  try
    with SaveDialog do
    begin
      FileName := '导出';
      Filter := '*.xls|*.xls|*.xlsx|*.xlsx|';
      if Execute then
      begin
        case SaveDialog.FilterIndex of
          1:
            ExportGridToExcel(SaveDialog.FileName, AcxGrid, true, true, true, 'xls');
          2:
            ExportGridToXLSX(SaveDialog.FileName, AcxGrid, true, true, true, 'xlsx');  //2007
        end;
      end;
    end;
  finally
    SaveDialog.Free;
  end;
end;
中年大叔学Delphi
原文地址:https://www.cnblogs.com/redhat588/p/15070450.html