C# 为什么Word.Application.Selection.Find.Execute在脚注和尾注中不起作用
为什么Word.Application.Selection.Find.Execute在脚注和尾注中不起作用? 我的代码是:C# 为什么Word.Application.Selection.Find.Execute在脚注和尾注中不起作用,c#,ms-word,office-interop,replaceall,footnotes,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 bForm
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);
您应该在ActiveDocument.StoryRanges之间进行迭代,以获取文档中的所有故事类型。 比如:
word.Range myRange = ActiveDocument.StoryRanges[wdMainTextStory]
word.Range myRange = ActiveDocument.StoryRanges[wdFootnotesStory]
myRange.Find.Execute(your parameters)
等等。
抱歉,我不喜欢c#。定义“不工作”我可以替换页面正文中的文本,但我无法在microsoft word的脚注和尾注部分执行该操作。