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

后端 未结 1 712
心在旅途
心在旅途 2021-01-22 20:36

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

Regards.

1条回答
  •  盖世英雄少女心
    2021-01-22 21:05

    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 shapes = wordDoc.MainDocumentPart.Document.Body.Descendants();
    }
    

    0 讨论(0)
提交回复
热议问题