Differentiate encrypted docx from encrypted pptx and encrypted xlsx

Hello Aspose.
I want to ask if Aspose words can differentiate encrypted docx from encrypted pptx and encrypted xlsx?
My Aspose version: C#
My use case: user submits encrypted file which can be pptx, xlsx and docx. This file has “tmp” extension. I want to detect the correct filetype, which is docx or xlsx or pptx. User dont submit the file’s password.
My code is
FileFormatInfo info = FileFormatUtil.DetectFileFormat(inputFile); // pptx and xlsx are detected as info.LoadFormat = docx.

Thanks you


Please ZIP and attach your sample encrypted .docx, .xlsx and .pptx files here for testing. We will then investigate the scenario on our end and provide you more information.

sample.zip (54.9 KB)
Thanks you for your response
I attached sample.zip which contains test.pptx and test.xlsx. These files have password “test” and are detected as docx .


We tested the scenario and managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-18019. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.


Regarding WORDSNET-18019, we have completed the work on your issue and concluded to close this issue as ‘Not a Bug’. Please see the following analysis details:

First of all, when you are using code like this:

Aspose.Words.FileFormatInfo info = FileFormatUtil.DetectFileFormat("E:\\temp\\sample\\test.docx");
Console.WriteLine(info.LoadFormat); // always returns DOCX

As the result you will get DOCX, because while an OOXML document is encrypted, it is not possible to ascertain whether it is an DOCM, DOCX, DOTM or Excel, or PowerPoint document without decrypting it first, so we just return DOCX by default.

So as you understand, to get correct load format, you have to specify password to open this document.

This code will return you correct format if it is Word document i.e. DOCX, DOCM etc:

LoadOptions loadOption = new LoadOptions();
loadoption.Password = "test";
Document doc = new Document("test.docx", loadOption);
Console.WriteLine(doc.OriginalLoadFormat.ToString());// will return .docx. 

Hope, this helps.

Thanks you for your support
I’m good now.