How can I distinguish between a picture with return characters and individual return characters?

I have a picture with return characters in my target file,There are also individual return characters in the file,How can I distinguish between a picture with return characters and individual return characters?

foreach (Aspose.Words.Paragraph p in builder.Document.Sections[0].Body.Paragraphs)
{
    if (string.IsNullOrEmpty(p.ToString(Aspose.Words.SaveFormat.Text).Trim()))
        p.Remove();
}

This code removes the image from the document,but I just want to remove the empty line, and I don’t want to remove the image

and Where can I download the source program(demo DocumentExplorer)

Hi there,

Thanks for your inquiry. Please use the following code to get the desired output. Hope this helps you.

Please get the code of Document-Explorer from Aspose.Words for .NET examples repository at GitHub.

Document doc = new Document(MyDir + "FigTest.docx");
foreach (Aspose.Words.Paragraph p in doc.Sections[0].Body.Paragraphs)
{
    if (string.IsNullOrEmpty(p.ToString(Aspose.Words.SaveFormat.Text).Trim())
    && p.GetChildNodes(NodeType.Shape, true).Count == 0)
        p.Remove();
}
doc.Save(MyDir + "17.5.docx");