更新时间:2023-01-25 18:39:43
在注释中提供了一些帮助之后,我实现了以下可行的解决方案
With some help provided in the comments, i realized the following working solution
findObject.ClearFormatting();
findObject.Text = @"\<*\>";
findObject.MatchWildcards=true;
findObject.Replacement.ClearFormatting();
findObject.Replacement.Text = "";
object replaceAll = Word.WdReplace.wdReplaceAll;
findObject.Execute(ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref replaceAll, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
使用搜索模式\<*\>
的
(包含通配符*
,因此 findObject.MatchWildcards 必须设置为 true ).
which is using the search pattern \<*\>
(containing the wildcard character *
, hence findObject.MatchWildcards must be set to true).