K
kisssun
Unregistered / Unconfirmed
GUEST, unregistred user!
我现在的代码只能实现替换一个字符串,但是就是不能替换相同的多个字符串。例如我的文档里有两个wm,我都要用edt_TotalMonths.text的值来替换掉,结果只有一个wm被替换,为啥?代码:
var
MyWord:Variant;
FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike,
MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace: OleVariant;
.....
MyWord.Visible := true;
MatchCase := False;
MatchWholeWord := True;
MatchWildcards := False;
MatchSoundsLike := False;
MatchAllWordForms := False;
Forward := True;
Format := False;
Replace := True;
FindText :='wm'; //修改月合计数
ReplaceWith :=edt_totalmonths.Text ;//使用edit内的内容进行替换
MyWord.ActiveDocument.Range.Find.Execute
( FindText, MatchCase, MatchWholeWord,MatchWildcards, MatchSoundsLike,
MatchAllWordForms, Forward, , Format, ReplaceWith, Replace );
var
MyWord:Variant;
FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike,
MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace: OleVariant;
.....
MyWord.Visible := true;
MatchCase := False;
MatchWholeWord := True;
MatchWildcards := False;
MatchSoundsLike := False;
MatchAllWordForms := False;
Forward := True;
Format := False;
Replace := True;
FindText :='wm'; //修改月合计数
ReplaceWith :=edt_totalmonths.Text ;//使用edit内的内容进行替换
MyWord.ActiveDocument.Range.Find.Execute
( FindText, MatchCase, MatchWholeWord,MatchWildcards, MatchSoundsLike,
MatchAllWordForms, Forward, , Format, ReplaceWith, Replace );