Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Deborah Pate question??

42 views
Skip to first unread message

Nicole Krueger

unread,
Jul 16, 2001, 2:10:46 PM7/16/01
to
Deborah-
I have looked at your web site on Automation and explains very well the
automation of Word and Delphi. I was wondering if you know how to automate
Word and Delphi, where Word is embedded in a Delphi form and you can still
use the word functionality. Any insite would be very greatfull. Thanks

Nicole


Deborah Pate (TeamB)

unread,
Jul 16, 2001, 2:34:37 PM7/16/01
to
<<Nicole Krueger:

I was wondering if you know how to automate
Word and Delphi, where Word is embedded in a Delphi form
and you can still use the word functionality.
>>

That's what TOleContainers are for (or you can use a
TTWebbrowser, too). Is that an option?

--
Deborah Pate (TeamB) http://delphi-jedi.org

Use Borland servers; TeamB don't see posts via ISPs
http://www.borland.com/newsgroups/genl_faqs.html


Werner Cloete

unread,
Jul 17, 2001, 8:52:56 AM7/17/01
to

Could you give us a quick example of how this is accomplished..? It would
be greatly appreciated... :o)

"Deborah Pate (TeamB)" <d.p...@cableinet.co.not-this-bit.uk> wrote in
message news:VA.00000a8...@cableinet.co.not-this-bit.uk...
: <<Nicole Krueger:

Deborah Pate (TeamB)

unread,
Jul 17, 2001, 9:18:27 AM7/17/01
to
<<Werner Cloete:

Could you give us a quick example of how this is
accomplished..? It would be greatly appreciated... :o)
>>

Disclaimer: I really, really hate TOleContainers and would
never dream of using one myself, unless I absolutely had to
as a database retrieval mechanism. Automation is slow and
bug-ridden enough without them, IMO. :)

Start a new application and drop a TOleContainer on a form.
Right-click on it, choose Insert Object, and in the dialog
you get select either CreateNew|Microsoft Word Document or
CreateFromFile and an appropriate Word document (which must
have a .doc extension - the container works out which
application to run from the extension). Compile and run,
then doubleclick on the container to activate it. (If you
prefer to activate it in code, put a line like
OleContainer1.DoVerb(ovShow);
in your form's OnShow method, for example.)

That's the basics. There's an olecontainer demo in the
Delphi\Demos\Activex folder that might interest you, too.

Werner Cloete

unread,
Jul 19, 2001, 6:56:22 AM7/19/01
to

ThanQ..! Your help and advice is greatly appreciated..! :o)

"Deborah Pate (TeamB)" <d.p...@cableinet.co.not-this-bit.uk> wrote in

message news:VA.00000a9...@cableinet.co.not-this-bit.uk...
: <<Werner Cloete:


: Could you give us a quick example of how this is
: accomplished..? It would be greatly appreciated... :o)
: >>
:
: Disclaimer: I really, really hate TOleContainers and would
: never dream of using one myself, unless I absolutely had to
: as a database retrieval mechanism. Automation is slow and
: bug-ridden enough without them, IMO. :)

:
Hehehe..! :o)

<SNIP>


michel.b...@gmail.com

unread,
Jan 29, 2019, 10:32:05 AM1/29/19
to

michel.b...@gmail.com

unread,
Jan 29, 2019, 10:39:55 AM1/29/19
to
On Monday, July 16, 2001 at 2:10:46 PM UTC-4, Nicole Krueger wrote:
Hi deborah,

Hope someone can help me with the following:
I am tring to select a section/piece of a word document loaded in a oleobject and have this copied into on the clipboard or ole word document container...My selection start somewhere between the doc where says "Inleiding" and ends somewhere below where says "bouwperiode"

This is my code:
Var
LVolvWord: OleVariant;
LVnStart, LVnEnd: Integer;
Begin
Try
Try
Screen.Cursor := crHourGlass;
LVolvWord := CreateOleObject('Word.Application');
LVolvWord.Visible := False; // Hide MS Word
LVolvWord.Documents.Open('c:\test.docx'); //Open the word document.
LVolvWord.ActiveDocument.Range.Select;
LVnStart := LVolvWord.ActiveDocument.Selection.Find.Execute('Inleiding');
LVnEnd := LVolvWord.ActiveDocument.Selection.Find.Execute('bouwperiode');

I need something like SelectRange(LVnStart, LVnEnd);

LVolvWord.ActiveDocument.Range.Copy; //Copy to Clipboard.

LVolvWord.ActiveDocument.Close; //Close the document.
//Now you can paste the text from clipboard.
//Memo1.PasteFromClipboard;
Except
// Error creating object
End;
Finally
LVolvWord.Quit; //Quit word.
LVolvWord := UnAssigned; //Free
Screen.Cursor := crDefault;
End;
0 new messages