My Homepage

MSWord Automation FAQ

This document offers solutions to some basic OLE Automation questions regarding Delphi (3 or four) and Microsoft Phrase (8.0). The ideas outlined here can be utilized to many different MS functions (Excel, Internet Explorer and so forth) in addition to any other software that supports OLE Automation. The code demonstrated above, illustrates tips on how to open a word doc, easy methods to create a new phrase document, selecting, copying, pasting, and doing a Find and Replace perform. As you possibly can see, when you get an understanding of how Word operates and go through the documentation it is possible for you to to automate all of the capabilities that Phrase has to provide.
 
The code demonstrated above, illustrates learn how to open a word doc, how you can create a brand new phrase doc, choosing, copying, pasting, and doing a Find and Substitute operate. As you'll be able to see, when you get an understanding of how Word operates and go through the documentation it is possible for you to to automate all of the functions that Phrase has to offer.
 
Word documents assist the usual formats CF_TEXT and CF_METAFILEPICT in addition to a number of different specific formats including RTF and structured storage. For the usual codecs the constant values can be utilized for the value Document Automation Consultant of cfFormat, but for the other codecs the Doc must be queried using the function EnumFormatEtc. This object is then passed to the DAdvise methodology of a Word Doc's IDataObject interface or to the Advise technique of a Phrase Document's IOleObject interface.
 
Word documents help the standard codecs CF_TEXT and CF_METAFILEPICT in addition to a lot of other particular codecs including RTF and structured storage. For the usual codecs the constant values can be used for the value of cfFormat, however for the opposite codecs the Document must be queried using the operate EnumFormatEtc. This object is then handed to the DAdvise method of a Word Doc's IDataObject interface or to the Advise method of a Phrase Doc's IOleObject interface.
 
Since this post is principally about Phrase Automation I will not describe how to do this, and I feel for you all it is a easy piece of work. Now what I would like is when I clicked Generate button I need all deal with particulars to be written back in a Word Document. Now you have got efficiently created a Phrase Template and this template might be used to create new paperwork with Person's deal with particulars. To get data from Phrase (RTF, textual content, structured storage etc) the IDataObject have to be used.