Aspose.Cells FileFormatUtil detects password-protected Word document as XLSX

Using the attached file (password for the file is ‘passwd’), the following code results in XLSX:
test.zip (13.7 KB)

using Aspose.Cells;
var formatInfo = FileFormatUtil.DetectFileFormat("test.docx");
if (formatInfo.LoadFormat == LoadFormat.Xlsx)
  throw new Exception("what is going on here?");

@Buffer2018,

Thanks for the sample document.

After an initial testing, I was able to reproduce the issue as you mentioned by using your sample document and sample code snippet. I found Aspose.Cells.FileFormatUtil detects password-protected Word document as XLSX.

We need to evaluate your issue in details. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-55116

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@Buffer2018
All office files will be encrpted as the same file, we can not dectect whether it’s a word or excel file without password.
We only can return formatInfo.IsEncrypted and formatInfo.FileFormatType. We have no plan to support this feature.
Please set the correct password to detect the file type with FileFormatUtil.DetectFileFormat(string filePath,string password) method.

@simon.zhao
It is ok that you cannot detect the specific file format if it is encrypted, but reporting it as Xlsx is wrong and is definitely a bug.

In my opinion, it should be reported as LoadFormat.Unknown.

@amjad.sahi FYI

@Buffer2018
Please check FileFormatInfo.FileFormatType not LoadFormat which returns FileFormatType .Ooxml.

@simon.zhao
I did check and it does; however, in my opinion, FileFormatInfo.LoadFormat should return LoadFormat.Unknown, as this is accurate information - the format of the file is unknown - and not LoadFormat.Xlsx, which is absolutely inaccurate.

@Buffer2018,

Thanks for your suggestion.

We will evaluate and check the feasibility and get back to you soon.