There are inserted images and several text paragraphs in the document. How can I delete all blank lines in the document without deleting the inserted image?
I used the following code to delete the blank lines in the document, but the images in the document were also deleted.:哭泣:
var paras = doc.GetChildNodes(NodeType.Paragraph, true).OfType<Paragraph>();
foreach (var para in paras)
{
if (para.ToString(SaveFormat.Text) == "\r\n")
{
para.Remove();
}
}