procedure OutExcel(TableCDS: Tadoquery; Status:TStatusBar; items_i:integer; statusdrawrect1:trect; frm: Tform; caption:string='');
var
    I, Count, Row: integer;
    RangeName: String;
    dbf_progress:tprogressbar;
    status_count,staPanleWidth:integer;
    MSExcel,Range: OleVariant;
begin
    MSExcel := CreateOleObject('Excel.Application');
    MSExcel.Visible := false;
    MSExcel.WorkBooks.Add;
    MSExcel.ScreenUpdating := False;
    MSExcel.caption := caption;
//    msexcel.activesheet.pagesetup.centerheader:=caption;
//    msexcel.activesheet.pagesetup.printgridlines:=true;
//    msexcel.activesheet.pagesetup.centerfooter:='第&P页';    dbf_progress:=TProgressbar.create(frm);
    staPanleWidth:=status.Panels.Items[items_i].width;
    with TableCDS do begin
      Count := FieldCount-1;
      last;
      status_count:=recordcount;//进程条的最大值
    end;
    status.repaint;
    with dbf_progress do begin
      top:=StatusDrawRect1.top;
      left:=StatusDrawRect1.left;
      width:=StatusDrawRect1.right-StatusDrawRect1.left;
      height:=StatusDrawRect1.bottom-StatusDrawRect1.top;
      visible:=true;
      try
          Parent := status; //该进程条的拥有者为状态条status
          Min := 0; Max := status_Count; //进程条的最大和最小值
          Step := 1; //进程条的步长
          Row := 1;
          RangeName := 'A'+IntToStr(Row);
          Range := MSExcel.Range[RangeName, RangeName];
          with tablecds do begin
            for I := 0 to Count do  begin
              range.font.bold:=true;
              Range.Value := Fields[I].DisplayLabel; //将字段头写入excel文件的第一行
              Range := Range.Next;  //excel文件的下一列
            end;
//            msexcel.activesheet.columns[1].numberal:='文本';   //控制此列输出属性为text
            DisableControls;
            First;
            while not eof do begin
              Inc(Row);  //row:=row+1;  excel文件的下一行
              RangeName := 'A'+IntToStr(Row);
              Range := MSExcel.Range[RangeName, RangeName];
              for I := 0 to Count do begin
                //Range.Value := ''''+Fields[I].AsString;
                Range.Value := Fields[I].AsString;
                Range := Range.Next;
              end;
              Next;
              Stepit; // 累加进程条
            end;
            EnableControls;
          end;
      finally
          Free; //释放进程条
      end; //try
    end; //with
    MSExcel.ScreenUpdating := True;
    MSExcel.Visible := True;
    MSExcel.Quit;
end;
或者用ehlib控件