试试下面的代码我用来划表格没有问题
var r:range;
rettable:Table;
mycolumns:columns;
mycolumn:column;
mycells:cells;
mycell:cell;
myrow:row;
i,j,k,icount,jcount,kcount:Byte ;
begin
r:=fwordapp.Selection.Range ;
rettable:=fwordapp.Selection.Tables.Add(r,5,3);
mycolumns:=rettable.Columns;
icount:=mycolumns.Get_Count;
for i:=0 to icount -1 do
begin
mycolumn:=mycolumns.Item(i+1);
jcount:=mycolumn.Cells.Count;
for j:=0 to jcount-1 do
begin
mycells:=mycolumn.Get_Cells;
kcount:=mycells.Get_Count;
for k:=0 to kcount -1 do
begin
mycell:=mycells.Item(k+1);
mycell.Get_Range.Set_Text('i:='+inttostr(i)+';j='+inttostr(j)+';k='+inttostr(k));
end;
end;
end;
end;
var r:range;
rettable:Table;
mycolumns:columns;
mycolumn:column;
mycells:cells;
mycell:cell;
myrow:row;
i,j,k,icount,jcount,kcount:Byte ;
begin
r:=fwordapp.Selection.Range ;
rettable:=fwordapp.Selection.Tables.Add(r,5,3);
mycolumns:=rettable.Columns;
icount:=mycolumns.Get_Count;
for i:=0 to icount -1 do
begin
mycolumn:=mycolumns.Item(i+1);
jcount:=mycolumn.Cells.Count;
for j:=0 to jcount-1 do
begin
mycells:=mycolumn.Get_Cells;
kcount:=mycells.Get_Count;
for k:=0 to kcount -1 do
begin
mycell:=mycells.Item(k+1);
mycell.Get_Range.Set_Text('i:='+inttostr(i)+';j='+inttostr(j)+';k='+inttostr(k));
end;
end;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货