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文档中的表格
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文档中的表格