Free Support Forum - aspose.com

Differentiate encrypted xlsx from encrypted pptx and encrypted docx


#1

Hello Aspose.
I want to ask if Aspose cells can differentiate encrypted xlsx from encrypted pptx and encrypted docx?
My Aspose version: 17.8.0.0. 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


#2

@truongminhlong,

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.


#3

@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 ?


#4

@truongminhlong,

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.


#5

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