公告
财富商城
积分规则
提问
发文
2020-04-16 04:57发布
何必那么认真
How can I get the list of shapes (textboxs) in an SdtBlock element using Open XML SDK?
Regards.
In order to grab all the shapes in a WordProcessingDocument you can use linq to traverse all the descendants of the body:
WordProcessingDocument
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(stream, true)) { IEnumerable<DocumentFormat.OpenXml.Vml.Shape> shapes = wordDoc.MainDocumentPart.Document.Body.Descendants<DocumentFormat.OpenXml.Vml.Shape>(); }
最多设置5个标签!
In order to grab all the shapes in a
WordProcessingDocument
you can use linq to traverse all the descendants of the body: