Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么Word.Application.Selection.Find.Execute在脚注和尾注中不起作用_C#_Ms Word_Office Interop_Replaceall_Footnotes - Fatal编程技术网

C# 为什么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

为什么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);

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

word.Range myRange = ActiveDocument.StoryRanges[wdMainTextStory]
word.Range myRange = ActiveDocument.StoryRanges[wdFootnotesStory]
myRange.Find.Execute(your parameters)
等等。
抱歉,我不喜欢c#。

定义“不工作”我可以替换页面正文中的文本,但我无法在microsoft word的脚注和尾注部分执行该操作。