1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
procedure TForm1.Replace(ChaineAvant,ChaineApres:String);
var FindText,
MatchCase,
MatchWholeWord,
MatchWildcards,
MatchSoundsLike,
MatchAllWordForms,
Forward,
Wrap,
Format,
ReplaceWith,
Replace,
MatchKashida,
MatchDiacritics,
MatchAlefHamza,
MatchControl: OleVariant;
MaZone: Range;
Begin
//Cherche et remplace ChaineAvant par ChaineApres dans tout le document
MaZone:=WordApplication1.ActiveDocument.Content;
FindText:=ChaineAvant;
MatchCase:=False;
MatchWholeWord:=True;
MatchWildcards:=False;
MatchSoundsLike:=False;
MatchAllWordForms:=False;
Forward:=True;
Wrap:=wdFindStop;
Format:=False;
ReplaceWith:=ChaineApres;
Replace:=wdReplaceAll;
MatchKashida:=False;
MatchDiacritics:=False;
MatchAlefHamza:=False;
MatchControl:=False;
MaZone.Find.Execute(FindText,MatchCase,MatchWholeWord,MatchWildcards,
MatchSoundsLike,MatchAllWordForms,Forward,Wrap,
Format,ReplaceWith,Replace,MatchKashida,MatchDiacritics,
MatchAlefHamza,MatchControl);
end; |
Partager