I do not have delphi 2005 installed at the momment but here is how i would od it using Delphi 6
add the following components to a form
1) TWordDocument (Servers Tab)
2) TwordApplication (Servers Tab)
3) Tbutton
4) TMemo
in the buttonclick event paste the following code
procedure TForm1.Button1Click(Sender: TObject);
var OpenDialog : TOpenDialog;
WordFileName,ReadOnly,Visible : OleVariant;
begin
OpenDialog := TopenDialog.create(Self);
OpenDialog.InitialDir := GetCurrentDir;
// Only Open Files that exists
OpenDialog.Options := [ofFileMustExist];
// Only Word Files
//OpenDialog.Filter :=
ReadOnly := True;
Visible := False;
if OpenDialog.Execute then
begin
WordFileName := OpenDialog.FileName;
WordDocument1.ConnectTo(WordApplication1.Documents.Open(WordFileName,
EmptyParam,
ReadOnly,
EmptyParam,
EmptyParam,
EmptyParam,
EmptyParam,
EmptyParam,
EmptyParam,
EmptyParam,
EmptyParam,
Visible));
Memo1.Lines.Clear;
Memo1.Lines.Text := WordDocument1.Content.Text;
end;
end;