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

Hello,

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 =
              Aspose.Words.FileFormatUtil.DetectFileFormat(@"C:\\document.docx");
Console.WriteLine(wordsFileFormatInfo.LoadFormat);

image.png (10.2 KB)
document.zip (160 Bytes)

@vitaliy1924

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!

@vitaliy1924

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