Consultor Eletrônico



Kbase P183833: Warning message displayed when generating Microsoft Excel file from WebSpeed CGI wrapper
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/9/2011
Status: Unverified

SYMPTOM(s):

Warning message displayed when generating Microsoft Excel file from WebSpeed CGI wrapper

"The file you are trying to open, '[filename]', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?" (Yes | No | Help)

Message is displayed before file generated by CGI wrapper is opened in Excel.

Message is displayed if Excel 2007 or later is installed.

FACT(s) (Environment):

Message is not displayed if Excel 2003 or earlier is installed.
MIME content type is "application/x-msexcel", "application/vnd.ms-excel ", or "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".
File opens correctly if user clicks "Yes" in the message box.
Windows
Progress 9.x
OpenEdge 10.x

CAUSE:

This is expected behavior. The alert is a new security feature in Excel 2007 called Extension Hardening, which ensures that the file content being opened matches the extension type specified in the shell command that is attempting to open the file. Because the MIME types mentioned above are associated with the .xls or .xlsx extension, the file must be in XLS (BIFF8) file format or Office Open XML format respectively to open without this warning prompt. If the file type is a different format (such as the HTML type generated by the CGI wrapper) the prompt is expected since the file content is different that the extension or MIME type.
Note that simply setting the MIME content type to "application/x-msexcel" ", "application/vnd.ms-excel ", or "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" in the SpeedScript code for the CGI wrapper does not change the fact that the file generated is HTML format, not XLS format or Office Open XML format. (The file may be saved in XLS or Office Open XML format after it is opened in Excel.)

FIX:

Depending on the requirements of the application, the warning may be avoided in one of the following ways:

Use the HTML MIME type. This will cause the spreadsheet to open in the web browser rather than in Excel.

For applications that control both the web server and the client desktops that need access to it, create a custom MIME type for both sides to use.

Configure client desktops to bypass the security check in the Windows registry. This will disable the check for any MIME files opened in Excel, not just those created by a specific WebSpeed application.

Run regedit.
Navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security
Add a new DWORD value ExtensionHardening with a value of 0 (zero). (If the ExtensionHardening value already exists, set it to 0 (zero)).

For details on setting the registry key, and considerations for deciding whether this action is appropriate, see the Microsoft article referenced below.