procedure TForm7.ToolButton1Click(Sender: TObject);
var start,endd
levariant;
ran2,ran:range;
tab:table;
i,j:integer;
begin
{ran:=wordapplication1.ActiveDocument.Range(start,endd);
ran.InsertAfter(edit2.Text);
ran.InsertParagraphAfter;
ran.Font.Name:='隶书';
ran.Font.Size:=24;
ran.Font.Color:=clred;}
tab:=wordapplication1.ActiveDocument.Tables.Item(1);
tab.cell(1,1).range.text:='插入到表格';
for i:=1 to tab.Rows.Count do
for j:=1 to tab.Columns.count do
begin
tab.cell(i,j).Range.Text:=inttostr(i)+inttostr(j)+'表格';
end;
start:=77;
endd:=77;
ran:=wordapplication1.ActiveDocument.Range(start,endd);
ran.InsertAfter('edit2.Text');
ran.InsertParagraphAfter;
ran.Font.Name:='隶书';
ran.Font.Size:=24;
ran.Font.Color:=clred;
end;
表格也算字符位置,