Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/320.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.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# 如何使用C在Microsoft Word中查找段落中的脚注位置#_C#_Ms Word_Ms Office_Footnotes_Paragraphs - Fatal编程技术网

C# 如何使用C在Microsoft Word中查找段落中的脚注位置#

C# 如何使用C在Microsoft Word中查找段落中的脚注位置#,c#,ms-word,ms-office,footnotes,paragraphs,C#,Ms Word,Ms Office,Footnotes,Paragraphs,目前,我使用 foreach (Microsoft.Office.Interop.Word.Paragraph para in doc.Paragraphs) { Microsoft.Office.Interop.Word.Range range = para.Range.Duplicate; string x = ""; for (int i = 1; i <= para.Range.Fo

目前,我使用

     foreach (Microsoft.Office.Interop.Word.Paragraph para in doc.Paragraphs)
        {
            Microsoft.Office.Interop.Word.Range range = para.Range.Duplicate;

            string x = "";
            for (int i = 1; i <= para.Range.Footnotes.Count; i++)
            {
                x = para.Range.Footnotes[i].Range.Text;
             }
        }
foreach(文件段落中的Microsoft.Office.Interop.Word.段落段落段落)
{
Microsoft.Office.Interop.Word.Range=para.Range.Duplicate;
字符串x=“”;

对于(int i=1;i我认为最好的选择是使用
。查找
范围对象的
属性。您需要搜索表示脚注标记(在范围内)的
^f

首先,我向您展示VBA中的代码(我更了解哪种语言):

我认为在C#中,它将如下所示(或类似,未经测试):

para.Range.Select
Selection.Find.Execute "^f"
//'the code below will insert footnote text after your footnote mark
Selection.InsertAfter " " & Selection.Footnotes(1).Range.Text
para.Range.Select;
Selection.Find.Execute("^f", ref Type.Missing, ref Type.Missing, ref Type.Missing, ref Type.Missing,
                             ref Type.Missing, ref Type.Missing, ref Type.Missing, ref Type.Missing,
                             ref Type.Missing, ref Type.Missing, ref Type.Missing, ref Type.Missing,
                             ref Type.Missing, ref Type.Missing);

Selection.InsertAfter(string.Format(" {0}", Selection.Footnotes[1].Range.Text));