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

Free Support Forum - aspose.com

Aspose.Cells.FileFormatUtil.DetectFileFormat incorrectly works with password protected Word and PowerPoint files


I found out that Aspose.Cells.FileFormatUtil.DetectFileFormat returns incorrect value in following cases:

1. “Excel2007Xlsx” for password protected DOCM/DOCX/DOTM/DOTX;

2. “Excel2007Xlsx” for password protected POTM/POTX/PPTM/PPTX.

I think the reason is that new (open xml) formats are saved in OLE package when they are password protected (even MS Office 2010 does not show error message until you enter password to open).

So it seems to be more logical to return something general like “OpenXMLFile” (or whatever you want), because you cannot guaranty that it is actually Excel (Word or PowerPoint) file.

But in this case it is highly important to ensure that CellsException with Code set to ExceptionType.FileFormat is thrown when you try to open not Excel file. For example here http://www.aspose.com/community/forums/526240/aspose.cells-opens-ole-objects/showthread.aspx#526240 OLE packages are successfully opened be Aspose.Cells.Workbook, whereas Aspose.Cells.FileFormatUtil.DetectFileFormat returns “Unknown”.

Used version – Aspose.Cells

Thank you,

Alex Shloma

Hi Alex,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue. Aspose.Cells detects these word and power point files as xlsx file.

We have logged this issue in our database. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-42394.

Hi Alex,

Thanks for your posting and using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET

If the Office Open Xml file is encrypted, it will return FileFormatType.Ooxml


Thank you, from first look all works fine. Continue testing.

Best regards,
Alex Shloma


Good to know that your issue is resolved by the new fix. Feel free to write back in case you still have an issue or have some other queries or issue, we will be happy to assist you soon.

Thank you.

The issues you have found earlier (filed as CELLSNET-42394) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.