为什么Word.Application.Selection.Find.Execute在脚注和尾注中不起作用

时间:2015-08-18 05:40:32

标签: c# ms-word office-interop replaceall footnotes

为什么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 个答案:

答案 0 :(得分:0)

您应该在ActiveDocument.StoryRanges之间进行迭代,以获取文档中的所有故事类型。 类似的东西:

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

等等。 对不起,我不喜欢c#。