How to get list of shapes in SdtBlock element using Open XML SDK?

醉酒当歌 提交于 2019-12-02 04:15:09

问题


How can I get the list of shapes (textboxs) in an SdtBlock element using Open XML SDK?

Regards.


回答1:


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>();
}


来源:https://stackoverflow.com/questions/7805882/how-to-get-list-of-shapes-in-sdtblock-element-using-open-xml-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!