你自己写个函数吧
用COM先创建一个Excel对象
然后操作ClientDataSet内容到该Excel对象

解决方案 »

  1.   

    clientdataset和其他的数据集控件一样,只要读取其数据并转换到excel即可  try
        if VarIsEmpty(XlsApp) then
          XlsApp := Createoleobject('Excel.Application');
        XLsApp.Workbooks.Add;
        XlsSheet := XLsApp.Worksheets['Sheet1'];
      except
        Application.MessageBox(pchar('Ms Excel 无法启动,数据转入终止!'),pchar('注意'),mb_ok);
        Abort;
      end; with dm1.clientdataset do
      begin
        first;
        for  I := 0 to RecordCount-1 do
        begin
          for J:=0 to fields.count - 1 do
          begin
            XlsSheet.Cells[ I + 1, J + 1] := Fields[J].Asstring
          end;
          Next;
        end;
      end;
      XlsApp.Visible := true;