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 Automation with TWordApplication and TWordDocument

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





PostPosted: Tue Dec 09, 2003 9:46 pm    Post subject: Word Automation with TWordApplication and TWordDocument Reply with quote



Hi Deborah,

After going through all the listings here and also
http://www.djpate.freeserve.co.uk/Automation.htm site which you have
provided, tried using the same sample for word, using Delphi 6.

Rest of the things work gr8! But replace functionality gives a problem while
replacing a specific word in the document.

Following is the same procedure from example.

procedure TMain.ReplaceBtnClick(Sender: TObject);
var
SearchText, ReplaceText, Wrap, All: OleVariant;
TextRange: Range;
begin
{ Replace text }
SearchText := 'pathetic';
ReplaceText := 'marvellous';
Wrap := wdFindContinue;
All := wdReplaceAll;
Doc.Content.Find.ExecuteOld(SearchText, EmptyParam, EmptyParam,
EmptyParam,
EmptyParam, EmptyParam, EmptyParam, Wrap,
EmptyParam, ReplaceText, All);

{ Find text and format it. This time we define our own range, so that
it can be redefined when the Find is executed. }
TextRange := Doc.Content;
SearchText := 'lorem ipsum dolor';
TextRange.Find.ExecuteOld(SearchText, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, Wrap,
EmptyParam, EmptyParam, EmptyParam);
TextRange.Font.Italic := integer(True);
end;

it gives an error as "The Stub return bad data" and after that keeps giving
AV.

Can u suggest anything?

Appreciate your help!

Thanks


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.