Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.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/3/xpath/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# 如何使用office interop迭代Word文档中的段落项?_C#_Vsto_Office Interop - Fatal编程技术网

C# 如何使用office interop迭代Word文档中的段落项?

C# 如何使用office interop迭代Word文档中的段落项?,c#,vsto,office-interop,C#,Vsto,Office Interop,如何使用office_interop在Word文档中迭代段落项目(如段落的图像、文本框等?这是您可以迭代文档段落的方式 foreach (Word.Paragraph paragraph in myDocument.Paragraphs) { string pText = paragraph.Range.Text; System.Diagnostics.Debug.WriteLine(pText); Word.InlineShapes shapes = paragraph.R

如何使用office_interop在Word文档中迭代段落项目(如段落的图像、文本框等?

这是您可以迭代文档段落的方式

foreach (Word.Paragraph paragraph in myDocument.Paragraphs)
{
   string pText = paragraph.Range.Text;
   System.Diagnostics.Debug.WriteLine(pText);

   Word.InlineShapes shapes = paragraph.Range.InlineShapes;
   System.Diagnostics.Debug.WriteLine("Shape Count: " + shapes.Count);
}

嗨,谢谢你的建议。但我的要求不是反复阅读这些段落。我想迭代一个特定的段落并访问该段落的成员(如形状、文本框等),请检查我的更新答案。基本上,您可以使用
段落.Range.InlineShapes