BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Word Find/Replace with Delphi 4

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Martin schaefer
Guest





PostPosted: Mon Nov 17, 2003 2:38 pm    Post subject: Word Find/Replace with Delphi 4 Reply with quote




Hi,
Actually I work witz Delphi 4 and I have to find an replace
single Words in an Word document. Ok I´ve inserted an OLE-Container
in my Form and I found a Function Find.Execute in the Word_TlB.

But I´ve problems to handle that. Is there somenone who can give me
a short example ??

By // Martin

Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Mon Nov 17, 2003 3:33 pm    Post subject: Re: Word Find/Replace with Delphi 4 Reply with quote



< Actually I work witz Delphi 4 and I have to find an replace
single Words in an Word document. Ok I´ve inserted an
OLE-Container in my Form and I found a Function
Find.Execute in the Word_TlB.
Quote:



var
Doc: OleVariant;
...
OleContainer1.DoVerb(ovShow);
Doc := OleContainer1.OleObject;

Doc.Range.Find.Execute('old',
ReplaceWith := 'new', Replace := wdReplaceAll);

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

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Martin schaefer
Guest





PostPosted: Mon Nov 17, 2003 4:17 pm    Post subject: Re: Word Find/Replace with Delphi 4 Reply with quote




Hi Deborah


Fine your Code does exactly what I want. But there is a small
problem. After the
OleContainer1.DoVerb(ovShow);
command the olecontainer views the Toolbars very cruel outside of my
application. is there a possibility to avoid this ?

// Martin


Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Mon Nov 17, 2003 5:23 pm    Post subject: Re: Word Find/Replace with Delphi 4 Reply with quote

< the olecontainer views the Toolbars very cruel outside of
my application. is there a possibility to avoid this ?
Quote:


Sorry, I don't think cruel is the word you want, so I'm not
sure what the problem is. IME olecontainers work best if
they're on a panel (aligned alClient) with another panel
(aligned alTop, Locked = False) above them for the toolbars
to go in. If that doesn't help, please post again with
another explanation of the problem. :)

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

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Martin schaefer
Guest





PostPosted: Mon Nov 17, 2003 6:13 pm    Post subject: Re: Word Find/Replace with Delphi 4 Reply with quote

TeamB wrote:


Thanks Deborah


Found a solution by accident

Doc.CommandBars['Text'].Enabled := False;

it is possible to set the commandbars invisible
that seems to be the solution. Perhaps my efect happend
because i use the olecontainer i an MDI-Child..


One last Question for today

how can i close the document
when i made my changes ??

// Martin


Back to top
Deborah Pate (TeamB)
Guest





PostPosted: Mon Nov 17, 2003 10:21 pm    Post subject: Re: Word Find/Replace with Delphi 4 Reply with quote

< how can i close the document
when i made my changes ??
Quote:


OleContainer.Close;
OleContainer.DestroyObject;

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

TeamB don't see posts sent via Google or ISPs
Use the real Borland server: newsgroups.borland.com
http://www.borland.com/newsgroups/genl_faqs.html



Back to top
Martin schaefer
Guest





PostPosted: Wed Nov 19, 2003 3:51 pm    Post subject: Re: Word Find/Replace with Delphi 4 Reply with quote


Hello Deborah,
with your help I´ve got my application so far on the way.
But there is still something...

Is there a possibility to completely switch of the toolbars?
The OleContainer is used in my App only for showing autoreplace and
printing some documents and so there is no need for the word toolbars

By Martin


Back to top
Martin schaefer
Guest





PostPosted: Thu Nov 20, 2003 8:49 pm    Post subject: Re: Word Find/Replace with Delphi 4 Reply with quote


Hello,

Well I recognized, that there is no way do deactivate the toolbars
completely. So I forced them in a panel by setting the locked property
in the panels outside my wished area. Well It´s not the way I like it,
but actually a acurrate compromise...

Thanks for the help !


By Martin
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.