Board index » delphi » How can I insert data into MS-Word

How can I insert data into MS-Word

Best,

I am a student user of Borland Delphi 3 so I didn't have the Borland books.
I only have another book but there is very little information of OLE in it.
I am making a program in which you can press a button and then MS-Word will
start. The Delphi programm puts data (from a database) into the Word
document.
I did't have a idea how I have to do it.

I thank you in advance.

Rogier van IJperen
r...@dsv.nl

Vlaardingen, Holland.

 

Re:How can I insert data into MS-Word


If you're using Word97, this is the sort of thing:
var
  WordApp, Range: Variant;
begin
    WordApp := CreateOleObject('Word.Application');
    WordApp.Visible := True;
    WordApp.Documents.Add;
    Range := WordApp.Documents.Item(1).Range;
    Range.Text := 'Some text';
end;

If you import Word's type library (MSWord8.olb) Delphi's code insight
will give you some help, too.

HTH
Deborah Pate

Quote
Rogier van IJperen wrote in message

<917376817.902...@picard.dsv.nl>...
Quote
>I am a student user of Borland Delphi 3 so I didn't have the Borland
books.
>I only have another book but there is very little information of OLE
in it.
>I am making a program in which you can press a button and then
MS-Word will
>start. The Delphi programm puts data (from a database) into the Word
>document.
>I did't have a idea how I have to do it.

Other Threads