【发布时间】:2011-11-11 13:29:49
【问题描述】:
我试图在将内容解析为 xml 之前从 .docx 文件中删除空段落。我将如何实现这一目标?
Protected Sub removeEmptyParagraphs(ByRef body As DocumentFormat.OpenXml.Wordprocessing.Body)
Dim colP As IEnumerable(Of Paragraph) = body.Descendants(Of Paragraph)()
Dim count As Integer = colP.Count
For Each p As Paragraph In colP
If (p.InnerText.Trim() = String.Empty) Then
body.RemoveChild(Of Paragraph)(p)
End If
Next
End Sub
【问题讨论】:
标签: vb.net openxml-sdk