Return to Snippet

Revision: 20217
at November 10, 2009 01:12 by Light


Initial Code
//Объявление
function SimpleReplace(Tag: string; New:string):boolean;

//Описание
//Процедура поиска и замены простых строк//////////////////////////////////////////////////
function TForm1.SimpleReplace(Tag: string; New:string):boolean;
begin
SimpleReplace:=true;
 try
 MsWord.Selection.End:=0;
 MsWord.Selection.Start:=0;
 MsWord.Selection.Find.Forward:=true;
 MsWord.Selection.Find.Text:= Tag;
  if MsWord.Selection.Find.Execute then begin
   MsWord.Selection.Delete;
   MsWord.Selection.InsertAfter(New);
   SimpleReplace(Tag, New);
  end else SimpleReplace:=false; //if
  except
  SimpleReplace:=false;
 end;//try
end;
//End SimpleReplace//////////////////////////////////////////////////////////////

//Реализация
Var="Text_To_Past";
SimpleReplace('text_to_replace', Var);//Замена текста

Initial URL


Initial Description


Initial Title
Замена текста в MS Word

Initial Tags


Initial Language
Delphi