1
XMLにコンテンツを解析する前に、.docxファイルから空の段落を削除しようとしています。どうすればこれを達成できますか?Open XML SDK 2.0を使用して.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