procedure TForm1.Button1Click(Sender: TObject);
var
wdApp, wdDocs, wdDoc : Variant;
file_name, s: string;
x,y: integer;
begin
file_name:='D:\test.doc';
wdApp := CreateOleObject('Word.Application');
try
wdApp.Visible := false;
wdDocs := wdApp.Documents;
wdDoc := wdDocs.Open(file_name);
for x := 1 to wdDoc.Tables.Item(1).Rows.Count do
for y := 1 to wdDoc.Tables.Item(1).Columns.Count do
begin
try
s := wdDoc.Tables.Item(1).Cell(x,y).Range.Text;
except
s := 'None';
end;
Memo1.Lines.Add('('+IntToStr(x)+','+IntToStr(y)+') ' + s);
end;
finally
wdApp.Quit;
end;
end;
try
current_string:=wdDoc.Tables[1].Cell(x,y).Range.Text;
except
current_string:='None';
end;