本文介绍了如何使用Open XML SDK在SdtBlock元素中获取形状列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Open XML SDK获取SdtBlock元素中的形状(文本框)列表?
How can I get the list of shapes (textboxs) in an SdtBlock element using Open XML SDK?
致谢.
推荐答案
要获取WordProcessingDocument
中的所有形状,可以使用linq遍历身体的所有后代:
In order to grab all the shapes in a WordProcessingDocument
you can use linq to traverse all the descendants of the body:
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(stream, true))
{
IEnumerable<DocumentFormat.OpenXml.Vml.Shape> shapes = wordDoc.MainDocumentPart.Document.Body.Descendants<DocumentFormat.OpenXml.Vml.Shape>();
}
这篇关于如何使用Open XML SDK在SdtBlock元素中获取形状列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!