FileFormatUtil.DetectFileFormat returns Incorrect File Format for 0KB Document using .NET


I faced an issue with DetectFileFormat method. It doesn’t work with my newly created empty document.
Here is my code:

Aspose.Words.FileFormatInfo wordsFileFormatInfo =

image.png (10.2 KB) (160 Bytes)


Your input document have 0kb file size. The file with zero length has no header. All object files have the header by which one can understand that the format and version of the format. If you open such file in notepad, you can see nothing in notepad editor.

Please do not use 0kb file size document in FileFormatUtil.DetectFileFormat.

Ah, ok. Thank you for your response!


Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.