你用YAHOO查找EXCEL,DELPHI嘛,或者看EXCEL97.PAS,应该可以解决得

解决方案 »

  1.   

    怎么UP?YAHOO的文章也看过了,不过不系统。有没有更直接的?
      

  2.   

      正好我最近在用Delphi做一个和控制Excel的模块。问过很多人都没有答复。后来自己花很多时间才发现在Delphi中完全控制Excel的资料。我希望大家少走弯路时间宝贵啊!
      其实远在天边,近在眼前。如果你的电脑中安装了EXCEL, 那么请搜索文件'VBAXL9',找到后打开这个文件,你想要的一切都在里面。
      

  3.   

    将stringgrid传入excelprocedure Tdm.CreateExcel(Sender:Tobject;ATitle:String);
    var
      RowCount,iCounter:integer;
      i,j:integer;
      Excelapp:OleVariant;
    begin
      Excelapp:=CreateOLEObject('excel.Application');
      Excelapp.Visible := true ; ;//ok!
      if (sender is TstringGrid) then
      begin
       RowCount:=(sender as TStringGrid).RowCount;;
       icounter:=(sender as TStringGrid).ColCount;;
       Excelapp.workbooks.add ;
       Excelapp.Cells(1,1):=ATitle;
       for i:=1 to RowCount do
       begin
        for j:=1 to iCounter do
        begin
        Excelapp.Cells(i+1,j):=(sender as TStringGrid).Cells[j-1,i-1];
        end;
       end;
      end;
    end;
      

  4.   

    搜索VBAXL9,没有这样的文件哦
    OFFICE2000版本,全部安装都没有
      

  5.   


      不会啊,它是随Office 2000安装的帮助文件。 这个文件的全名是 "vbaxl9.chm"。里面有Excel中所有的对象、属性、方法的说明和使用详解。
      

  6.   

    给你个大概
    procedure TF_Ypzbwh.N_DcClick(Sender: TObject);
    var eclApp:Variant;
        xlsFileName:String;
        i,j:Integer;
    begin
      if not SD_ExcelName.Execute then Exit;
      XlsFileName:=SD_ExcelName.FileName;
      if Trim(XlsFileName)='' then Exit;
      if FileExists(XlsFileName) then
        DeleteFile(XlsFileName);
      Try
        StartWait('正在将数据另存为Excel文件,请稍候...');
        eclApp:=CreateOleObject('Excel.Application');
        eclApp.WorkBooks.Add;
      Except
        MessageBox(self.Handle,'你的机器里未安装MicroSoft Excel!','错误',MB_ICONERROR);
        StopWait;
        Exit;
      End;
      Try
        //MessageBox(self.Handle,'下面演示新建一个XLS文件,并写入数据,最后关闭它!','信息',MB_ICONINFORMATION);
        With DM.Qcomm do begin
          Close;
          SQL.Clear;
          SQL.Add('select * from v_YpxxZw ');
          Open;
          for i:=1 to FieldCount do begin
            eclApp.WorkBooks[1].WorkSheets[1].Cells(1,i):=Fields.Fields[i-1].FieldName;
            eclApp.WorkBooks[1].WorkSheets[1].Columns[i].Font.Name:='宋体';
            eclApp.WorkBooks[1].WorkSheets[1].Columns[i].Font.Size:=10;
            eclApp.WorkBooks[1].WorkSheets[1].Columns[i].NumberFormatLocal:='@';
            eclApp.WorkBooks[1].WorkSheets[1].Columns[i].HorizontalAlignment := xlCenter;
          end;
          for j:=2 to RecordCount+1 do begin
            for i:=1 to FieldCount do begin
              eclApp.WorkBooks[1].WorkSheets[1].Cells(j,i):=Fields.Fields[i-1].AsString;
              WaitProgress(Round((((j-2)*FieldCount+i)*100)/(RecordCount*FieldCount)));
            end;
            Next;
          end;
        end;
        eclApp.WorkBooks[1].SaveAs(xlsFileName);
        eclApp.WorkBooks[1].Close;
        eclApp.Quit;
        eclApp:=UnAssigned;
        StopWait;
        WinExec(PChar(xlsFileName),SW_SHOWNORMAL);
      Except
        MessageBox(self.Handle,'不能正确操作Excel文件。可能是该文件已被其它程序打开,或系统错误!','错误',MB_ICONERROR);
        eclApp.WorkBooks[1].Close;
        eclApp.Quit;
        eclApp:=UnAssigned;
        StopWait;
      End;
    end;
      

  7.   

    eclApp.WorkBooks[1].WorkSheets[1].Columns[i].HorizontalAlignment := xlCenter;
    中 ,delphi 编译时说没有定义  xlCenter 变量