当输入文本包含特殊字符或数字(字母数字)时,c#winword互操作查找和替换

当输入文本包含特殊字符或数字(字母数字)时,c#winword互操作查找和替换,c#,replace,find,interop,alphanumeric,C#,Replace,Find,Interop,Alphanumeric,我正在基于以下问题创建查找和替换方法: 但当输入有[myText]之类的特殊字符或myText0001之类的数字时,它就不起作用了 “查找对象”中是否有允许此操作的设置 以下是我的设置: object findText = (object)TextTofind; object replaceWithText = (object)TextToReplace; object matchCase = false; object matchWholeWord = true; object matchW

我正在基于以下问题创建查找和替换方法:

但当输入有[myText]之类的特殊字符或myText0001之类的数字时,它就不起作用了

“查找对象”中是否有允许此操作的设置

以下是我的设置:

object findText = (object)TextTofind;
object replaceWithText = (object)TextToReplace;
object matchCase = false;
object matchWholeWord = true;
object matchWildCards = false;
object matchSoundsLike = false;
object matchAllWordForms = false;
object forward = true;
object format = false;
object matchKashida = false;
object matchDiacritics = false;
object matchAlefHamza = false;
object matchControl = false;
object read_only = false;
object visible = true;
object replace = 2;
object wrap = 1;

object fileName = (fileNamePath);
aDoc = wordApp.Documents.Open(fileName, ReadOnly: false, Visible: true);
aDoc.Activate();
wordApp.Selection.Find.Execute(ref findText, ref matchCase, ref matchWholeWord,
  ref matchWildCards, ref matchSoundsLike, ref matchAllWordForms, ref forward, ref wrap, ref format, ref replaceWithText, ref replace,
  ref matchKashida, ref matchDiacritics, ref matchAlefHamza, ref matchControl);