Board index » delphi » Baffled and Confused... on Word Automation find
Bill
Delphi Developer |
Baffled and Confused... on Word Automation find2008-08-01 12:55:37 AM delphi252 Greetings; I am using Delphi 6 to automate MSWord on a search and replace mission. All is working fine except for a carriage return in the memo field. I have text in the memo that needs the CR inserted into the word doc. I have tried several approachs and none seem to work. Since the memo lines can vary in length, I choose to send a line to the search/replace routine plus the search field (i.e. replace <fieldname>with 'memo line'+<fieldname>until the last memo line is encountered then <fieldname>is dropped) this works okay but I cannot get a CR from the memo into the word doc. by current function looks like this ... WordApp.Selection.Find.ClearFormatting; WordApp.Selection.Find.Text := FT;//FT is the <FieldName>text if leftstr(RT,7)='<Vendor' then //if a CR is encountered, rt= ''+'<VendorSrvs>' or ''+'<VendorComp>' WordApp.Selection.TypeParagraph; //my last hope to insert CR... WordApp.Selection.Find.Replacement.Text := RT; WordApp.Selection.Find.Forward := True; //rest of the function WordApp.Selection.Find.MatchAllWordForms := False; WordApp.Selection.Find.MatchCase := true; WordApp.Selection.Find.MatchWildcards := False; WordApp.Selection.Find.MatchSoundsLike := False; WordApp.Selection.Find.MatchWholeWord := False; WordApp.Selection.Find.MatchFuzzy := False; WordApp.Selection.Find.Wrap := wdFindContinue; WordApp.Selection.Find.Format := False; WordApp.Selection.Find.Execute(Replace := wdReplaceAll); IS there a way to force the CR into the replace string? If so, can you point me to the correct way? Thanks for your time Regards Bill -- |