Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing microsoft word documents

Status
Not open for further replies.

tweetie777

Programmer
Nov 22, 2001
14
0
0
ZA
I am currently using Delphi 5. I need an example to show me how to print an already made microsoft word document(.doc) through my delphi program.




 
Reading a word .doc file is not easy (see file format details obtainable from and it doesn't appear that anyone's done it in Delphi. If you can have the user save his file in .rtf format from MS-Word then it should go into a TRichEdit.
 
Howdy,

Here is some simple code to try. This is accessing MS Word through OLE. You might have to refer to the MSDN Library (if you have access to it) or try the Microsoft Website for more help on the MS Office objects and properties that are available.

uses ComObj;

var
MSWord : OLEVariant;
begin
MSWord := CreateOLEObject('Word.Basic');
MSWord.FileOpen('c:\sample.doc');
MSWord.Print;
end;

Hope this helps.

WB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top