VC替换WORD,下面这段代码不好使。我想全文替换一个字符串,请高手给个好使的例子 Find wordFind;
Selection wordSel; m_doc.Select();
wordSel = m_WordApp.GetSelection();
wordFind = wordSel.GetFind(); CComVariant FindText = strOld;
CComVariant MatchCase = false;
CComVariant MatchWholeWord = false;
CComVariant MatchWildcards = false;
CComVariant MatchSoundsLike = false;
CComVariant MatchAllWordForms = false;
CComVariant Forward = true;
//CComVariant Wrap = true;
CComVariant Format = false;
CComVariant ReplaceWith = strNew;
// CComVariant Replace = true;
CComVariant Warp(_T("wdFindContinue"));
CComVariant Replace(_T("wdReplaceAll"));wordFind.Execute(&FindText, &MatchCase, &MatchWholeWord,
&MatchWildcards, &MatchSoundsLike,
&MatchAllWordForms, &Forward,
&Warp, &Format,
&ReplaceWith, &Replace,
&covFalse, &covFalse,
&covFalse, &covFalse);
Selection wordSel; m_doc.Select();
wordSel = m_WordApp.GetSelection();
wordFind = wordSel.GetFind(); CComVariant FindText = strOld;
CComVariant MatchCase = false;
CComVariant MatchWholeWord = false;
CComVariant MatchWildcards = false;
CComVariant MatchSoundsLike = false;
CComVariant MatchAllWordForms = false;
CComVariant Forward = true;
//CComVariant Wrap = true;
CComVariant Format = false;
CComVariant ReplaceWith = strNew;
// CComVariant Replace = true;
CComVariant Warp(_T("wdFindContinue"));
CComVariant Replace(_T("wdReplaceAll"));wordFind.Execute(&FindText, &MatchCase, &MatchWholeWord,
&MatchWildcards, &MatchSoundsLike,
&MatchAllWordForms, &Forward,
&Warp, &Format,
&ReplaceWith, &Replace,
&covFalse, &covFalse,
&covFalse, &covFalse);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货