//Paht 路径,S1待替换的字串,S2替代字串
procedure ReplaceDocStr(Path, S1, S2);
const
wdAlertsNone = $00000000;
wdRepalceAll = $00000002;
var
WordApp, WordDoc: OleVariant;
begin
WordApp := CreateOleObject('Word.Application');
WordApp.DisplayAlerts := wdAlertsNone;
WordApp.Documents.Open(Path);
WordApp.Selection.Find.ClearFormatting;
WordApp.Selection.Find.Replacement.ClearFormatting;
WordApp.Selection.Find.Text := S1;
WordApp.Selection.Find.Replacement.Text := S2;
WordApp.Selection.Find.Forward := True;
WordApp.Selection.Find.Execute(wdRepalceAll);
WordApp.Quit;
WordApp := Unassigned;
end;