Author Topic: Excel 2007 error: Different format than specified by the file extension  (Read 30843 times)

Offline admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 296
    • View Profile
In some cases after upgrading to Excel 2007, you may get the following error:
The file you are trying to open .xlsx is in a different format than specified by the file extension. verify the file is not corrupted and is from trusted source before opening the file. Do you want to open the file now?

This errors particularly occurs when you’re trying to open an XLS file (Excel 2000-2003) with Excel 2007. In most cases, the problem can be solved by defining MIME types and associating them with extensions.
When you’re using a Document Management System (like Sharepoint or Livelink), you can try adding these:
.xls = application/msexcel
.xlsx = application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

However, if you don’t want to look for a solution, but just want to solve the problem, insert this key in your registry to suppress the notification:

[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security]
“ExtensionHardening”=dword:00000000

You can accomplish the above by doing the following:

1- Open your Registry (Start -> Run -> regedit.exe)
2- Navigate to HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\OFFICE\12.0\EXCEL\SECURITY
3- Right click in the right window and choose New -> DWORD
4- Type “ExtensionHardening” as the name (without the quotes)
5- Verify that the data has the value “0″

This bug cannot be fixed through asp.net code. Here is more information on this problem:

http://blogs.msdn.com/vsofficedeveloper/pages/Excel-2007-Extension-Warning.aspx