If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Delphi 7 - Replace strings in header and footer ( MSWORD )

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-13-04, 08:20
ricardo.pascoal ricardo.pascoal is offline
Registered User
 
Join Date: May 2004
Location: Brazil
Posts: 1
Delphi 7 - Replace strings in header and footer ( MSWORD )

HI ALL , I HAVE AN APPLICATION THAT NEEDS TO DO SOME STRINGS REPLACES IN HEADER AND FOOTER, BUT MY CODE BELOW JUST CHANGE TEXT IN PRINCIPAL RANGE ( BODY ) AND NOT IN HEADER AND FOOTER.

I´M USING DELPHI7 AND THE TWORDAPPLICATION COMPONENT IN SERVERS PALETE

I CONT YOU TO HELP ME SOLVE THIS PROBLEM

THANKS


CODE :

// PUT THIS CODE IN A BUTTOM DO OPEN WORD DOCUMENT

var
FileName : OleVariant ;

begin

try

FileName := 'c:\teste.doc' ;

MyWordApplication.Documents.Open(
FileName , EmptyParam , EmptyParam , EmptyParam ,
EmptyParam , EmptyParam , EmptyParam , EmptyParam ,
EmptyParam , EmptyParam , EmptyParam , EmptyParam ) ;

MyWordApplication.Visible := True ;

MyWordApplication.ShowMe ;

end;


// PUT THIS CODE IN A BUTTOM TO REPLACE STRING IN DOCUMENT

var

Find_Text : OleVariant ;
ReplaceWith : OleVariant ;
Param_Replace : OleVariant ;

begin

Find_Text := 'TESTE' ;
ReplaceWith := 'TESTANDO' ;
Param_Replace := wdReplaceAll ;

MyWordApplication.ActiveDocument.Content.Find.Exec ute(
Find_Text ,
EmptyParam ,
EmptyParam ,
EmptyParam ,
EmptyParam ,
EmptyParam ,
EmptyParam ,
EmptyParam ,
EmptyParam ,
ReplaceWith ,
Param_Replace ,
EmptyParam ,
EmptyParam ,
EmptyParam ,
EmptyParam ) ;

MyWordApplication.ScreenRefresh ;

end;
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On