For example, let's take Microsoft Word 95. As you can see, it'll only take a few lines of code to make it possible to insert text to Word documents from your application (don't forget to add "OLEAuto" unit to your "uses" statement):
procedure InsertTextToWord( sText : string ); var W : Variant; begin { create an OLE object of } { type Word.Basic } W := CreateOleObject( 'word.basic' ); { call Word.Basic's Insert function } W.Insert( sText ); end; |
Using the above function, all you have to do is call it with the text you want to insert:
InsertTextToWord( 'hello, word!' ); |
To find out what other commands you can use to control Microsoft Word (for example) lookup its help for "WordBasic" -- the name of the macro language used to write custom applications for Word. To find out if your favorite application supports OLE automation, lookup its help for "OLE Automation."