1
XML로 내용을 파싱하기 전에 .docx 파일에서 빈 단락을 제거하려고합니다. 나는 이것을 어떻게 얻을 수 있을까?OpenXML 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