如何使用 Open XML SDK 获取 SdtBlock 元素中的形状(文本框)列表?
问候。
为了获取 a 中的所有形状,WordProcessingDocument
您可以使用 linq 遍历 body 的所有后代:
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(stream, true))
{
IEnumerable<DocumentFormat.OpenXml.Vml.Shape> shapes = wordDoc.MainDocumentPart.Document.Body.Descendants<DocumentFormat.OpenXml.Vml.Shape>();
}