We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Differentiate encrypted xlsx from encrypted pptx and encrypted docx

Hello Aspose.
I want to ask if Aspose cells can differentiate encrypted xlsx from encrypted pptx and encrypted docx?
My Aspose version: C#
My use case: user submits encrypted file which can be pptx, xlsx and docx. 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 docx are detected as info.LoadFormat = xlsx.

Thanks you


Thanks for your query.

We have analyzed the scenario and observed that as all advanced office files (e.g .DOCX, XLSX, .PPTX, etc.) are open XML files so the component thinks it is an .XLSX file (by default). Although it detects that the files are encrypted, however the exact type is not identified due to above mentioned fact. You may please detect the encryption status using this component and write your own logic based upon the extension of the file being examined. I am afraid that no more feature is available in this regard which can sort out your issue.

@ahsaniqbalsidiqui Thanks you for your fast reply
If I submits encrypted file as “test.tmp”, Apose cells detected it as XLSX by default even if the file can be docx and pptx. Is this the expected behavior ?


Yes, you are right as this utility detects the XML structure in the file, it considers it as Excel file. That is why you get file type as XLSX. Please feel free if you have any other query in this regard.

Thanks you :slight_smile: I have no more question
I appreciate your very fast reponse.


Please try our latest version/fix: Aspose.Cells for .NET v19.1.2 (attached)
We have supported your demanded feature (we logged a ticket with an id “CELLSNET-46552” for it). Please detect the file format with the password using the API:

FileFormatUtil.DetectFileFormat(Stream stream,string password)

Let us know your feedback.
Aspose.Cells19.1.2 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells19.1.2 For .Net4.0.Zip (4.8 MB)

The issues you have found earlier (filed as CELLSNET-46552) have been fixed in Aspose.Cells for .NET v19.2. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi