Delphi6中“SERVERS”栏内的Office2000控件看起来很诱人,但怎么用呢?    连个资料都没有,让我等闲人,还得用CreateOleObject('Word.Application')之类的旧方法调用WORD等应用程序。是否有高手可将此类控件细细说来听听…………

解决方案 »

  1.   

    (二) 使用Delphi 控件方法
    在Form中分别放入ExcelApplication, ExcelWorkbook和ExcelWorksheet。 1)  打开Excel 
    ExcelApplication1.Connect;2) 显示当前窗口:
    ExcelApplication1.Visible[0]:=True;3) 更改 Excel 标题栏:
    ExcelApplication1.Caption := '应用程序调用 Microsoft Excel';
      

  2.   

    ExcelApplication1.Visible[0]:=True;3) 更改 Excel 标题栏:
    ExcelApplication1.Caption := '应用程序调用 Microsoft Excel';以上两句不可用,出错。
      

  3.   

    你去bcblist看看上面有一编文章是写这个的
      

  4.   

    delphi自带的demo里有部分控件的演示,不过功能都比较简单,在activex里
      

  5.   

    我是看delphi的demo里面的activex的例子程序学会的阿,我现在会使用word,excel部分的组件阿,下面是我使用excel组件的一个例子程序阿!!procedure TForm7.Button5Click(Sender: TObject);
    var
      Range:excelrange;
      i,j,k:integer;
      letter:char;
    begin
    if datasource1.DataSet=nil then showmessage('没有内容可以导入Excel!')
    else begin
      try
        try
        excelapplication1.Connect;
        except
        showmessage('您的机器没有安装Excel!');
        abort;
        end;
        excelapplication1.Visible[0]:=true;
        excelapplication1.Caption:='送修内容';
        excelapplication1.Workbooks.Add(NUll,0);    k:=datasource1.DataSet.FieldCount-4;    if datasource1.DataSet.Fields[k].DisplayLabel='COUNT OF 局名' then
         k:=4
        else k:=0;    i:=65+datasource1.DataSet.FieldCount-1-k;
        letter:=char(i);    range:=excelapplication1.Range['A1',letter+'1'];    for i:=0 to datasource1.DataSet.FieldCount-1-k do
          begin
          range.Value:=datasource1.DataSet.Fields[i].DisplayLabel;
          range:=range.Next;
          end;
        if k=4 then begin
        range.Value:='数量';
        dec(k);
        end;
        datasource1.DataSet.First;    for i:=1 to datasource1.DataSet.RecordCount do begin
          range:=excelapplication1.Range['A'+inttostr(i+1),letter+inttostr(i+1)];
          for j:=0 to datasource1.DataSet.FieldCount-1-k do begin
            range.Value:=datasource1.DataSet.Fields[j].AsString ;
            range:=range.Next;
            end;
          datasource1.DataSet.Next;
          end;  except
      excelapplication1.Disconnect;
      end;  end;
    end;