Free Support Forum -

Empty docx-file throws exception


I use Aspose to convert Word-files to tif. The attached file is empty.
Aspose throws an exception on
Document doc = new Document(inFile);

I know, it’s not useful to convert an empty file, but I do not check before.
Is it possible for you, to create an empty tif-file in that case, or at least, not throw an exception?

best regards,

Hi Oliver,

Thanks for your request. I suppose you have created this file by right-clicking and selecting “New/Word document”. When you create a file such way, Windows Explorer creates a zero-length file with DOCX extension. But actually this file is not a DOCX document; this is just a “placeholder” where MS Word will write the actual document when you open it and save.

Since this file is zero-length Aspose.Words cannot determine format of this file and that is why throws an UnsupportedFileFormatException. This is an expected behavior with such file.

Best regards,