Почему Word.Application.Selection.Find.Execute не работает в сносках и примечаниях

Почему Word.Application.Selection.Find.Execute не работает в сносках и примечаниях? мой код:

object wrap = WdFindWrap.wdFindContinue;
object wdReplaceAll = WdReplace.wdReplaceAll;
object text = findWhat;
object replaceText = replaceWith;
object missing = Type.Missing;
object bFormat = true;
object forward = true;
Common.WordApplication.Selection.Find.Execute(ref text, ref missing, ref     missing,
ref missing, ref missing, ref missing, ref forward,
ref wrap, ref bFormat, ref replaceText, ref wdReplaceAll,
ref missing, ref missing, ref missing, ref missing);

1 ответ

Вы должны перебирать ActiveDocument.StoryRanges, чтобы получить все типы историй в документе. что-то вроде:

word.Range myRange = ActiveDocument.StoryRanges[wdMainTextStory]
word.Range myRange = ActiveDocument.StoryRanges[wdFootnotesStory]
myRange.Find.Execute(your parameters)

И так далее. Извините, я не фанат C#.

Другие вопросы по тегам