这是我写的一个word操作类中的一个函数,其中使用特殊字符串功能替换的方法实现
procedure TWordObj.Replace(str1,str2 : String);
var
findtext, matchcase, matchwholeword,
matchwildcards, matchsoundslike,
matchallwordforms, forward,
wrap, format, replacewith,
replace: OleVariant;
begin
findtext :=str1;
matchcase := false;
matchwholeword := true;
matchwildcards := false;
matchsoundslike := false;
matchallwordforms := false;
forward := true;
wrap := wdFindContinue;
format := false;
replacewith :=str2;
replace := true;
FWordApp.Selection.Range.Find.ExecuteOld(findtext, matchcase, matchwholeword,
matchwildcards, matchsoundslike, matchallwordforms, forward,
wrap, format, replacewith, replace);
end;