We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remove the empty paragraph

How to remove the empty paragraph line. Please help me.

@Mahesh39 You can use code like the following to remove empty paragraphs:

Document doc = new Document("in.docx");

Iterable<Paragraph> paragraphs = doc.getChildNodes(NodeType.PARAGRAPH, true);
for (Paragraph p : paragraphs)
{
    if (!p.hasChildNodes())
        p.remove();
}

doc.save("out.docx");