我做了个word表格的模版,表格比较错综复杂,,我如何才能把数据导入到表格中相应的位置上?谢谢各位大虾!最好能有实例

解决方案 »

  1.   

    procedure Twx_jczdaFrm.pEasyGridToWord(const Table,Y,YCount,PY:integer);
    var
      i,j:integer;
      AUnit,ACount :OleVariant;
    begin
       AUnit :=wdCharacter;
       ACount :=1;
       with WordApplication1 do
        begin
          if ActiveDocument.Tables.Count>0 then
            with Egryda do
              begin
                for j :=Y to YCount-1 do
                  for i:=0 to ColCount-3 do
                    with ActiveDocument.Tables.Item(Table) do
                    begin
                      Cell(j+PY,i+1).Range.InsertAfter(Egryda.Cells[i+2,j].ForeText);
                    end;
              end;
        end;end;ActiveDocument.Tables.Item(Table)这个是当前要在word文档中的表格
      

  2.   

    app.ActiveDocument.Books.Item('乙方').Range.Text:=CustName;
      

  3.   

    Word里面的域,可以用来接受数据的。