Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.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/8/design-patterns/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# 如何获取段落列表';从OpenXml将所有元素作为列表运行_C#_Openxml - Fatal编程技术网

C# 如何获取段落列表';从OpenXml将所有元素作为列表运行

C# 如何获取段落列表';从OpenXml将所有元素作为列表运行,c#,openxml,C#,Openxml,您好,我有一个OpenXmlElementList列表,它是OpenXmlElement的段落列表,我想从段落列表中获取所有运行 List<OpenXmlElement> oFieldNodes = GetParagraphs(); // this will return first paragraph's all runs. List<Run> oRuns = oFieldNodes[0].Descendants<Run>().ToList<Run&g

您好,我有一个OpenXmlElement
List
列表,它是
OpenXmlElement
的段落列表,我想从段落列表中获取所有运行

List<OpenXmlElement> oFieldNodes = GetParagraphs();
// this will return first paragraph's all runs.
List<Run> oRuns = oFieldNodes[0].Descendants<Run>().ToList<Run>(); 
eldnodes的列表=getparations();
//这将返回第一段的所有运行。
列出oRuns=oFieldNodes[0]。子体().ToList();
如何使用lambda表达式或linq从eldnodes的所有段落中获取运行列表

任何帮助都将不胜感激。 谢谢

您可以使用

List oRuns=oFieldNodes.SelectMany(o=>o.substands()).ToList();

工作起来很有魅力!!谢谢:很高兴帮助@ ANUJ -如果它解决了你的问题,你可以考虑(尽管你没有义务):谢谢,我正在寻找如何让答案接受…
List<Run> oRuns = oFieldNodes.SelectMany(o => o.Descendants<Run>()).ToList<Run>();