可以用WORD替换功能试一试。
with WORD.SelectRange.Find do begin
Text :='【☆☆☆☆☆】';
Replacement.Text := 【*****】;
ReFindText:=EmptyParam;
ReMatchCase:=EmptyParam;
ReMatchWholeWord:=EmptyParam;
ReMatchWildcards:=EmptyParam;
ReMatchSoundsLike:=EmptyParam;
ReMatchAllWordForms:=EmptyParam;
ReForward:=True;
ReWrap:=wdFindContinue;
ReFormat:=EmptyParam;
ReReplaceWith:=EmptyParam;
ReReplace:=wdReplaceAll;
SelectRange.Find.Execute(ReFindText,ReMatchCase,
ReMatchWholeWord,ReMatchWildcards,
ReMatchSoundsLike,ReMatchAllWordForms,
ReForward,ReWrap,ReFormat,
ReReplaceWith,ReReplace);
end;
判断标签是否存在:
ThisDoc.Bookmarks.Exists('标签1')
得到标签的位置:
ThisDoc.Bookmarks.Item('标签1').Get_Start;
ThisDoc.Bookmarks.Item('标签1').Get_End_;