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

Free Support Forum - aspose.com

Delete Blank/Empty Documents using JAVA

Hi team,

Requesting a work around solution to delete blank/empty word document using JAVA.

Priya Dharshini J P


Thanks for your inquiry. Please use following code example to delete empty document from the disk. Hope this helps you.

Document doc = new Document(MyDir + "input.docx");
if(doc.toString(SaveFormat.TEXT).trim().length() == 0)
    File file = new File(MyDir + "input.docx");

        System.out.println(file.getName() + " is deleted!");
        System.out.println("Delete operation is failed.");

Thanking You @tahir.manzoor

Priya Dharshini J P