Examples Delphi

The following Delphi 5 code will open and print a word document.
var
oWord : TWordApplication;
varFileName : OleVariant;
begin
oWord := TWordApplication.Create (Nil);
Try
oWord.Connect;
varFileName := 'c:\temp\test.doc';
oWord.Documents.Open (varFileName,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam);
oWord.ActiveDocument.PrintOut (EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam);
oWord.Disconnect;
Finally
oWord.Free;
End;