Document.PageCount works nearly endlessly instead of throwing exception if user tries to open non-Word document with Aspose.Words

Hi,

If I open any non-Word document with changed extension to *.docx, code

Dim Document As New Aspose.Words.Document(FilePath)

Dim PagesCount As Integer = Document.PageCount


doesn’t throw an exception that file format is incorrect, but “hangs”. Test application with sample document is attached.


Is there any chance that Aspose.Words will handle it?


Thanks!

Hi Olexandr,


Thanks for your inquiry. Your document is not a valid MS Word document. MS Word does not open it. Please check the attached image for detail.

Please use latest version of Aspose.Words for .NET 16.10.0. It throws Aspose.Words.UnsupportedFileFormatException.