Getting extension check(hardening) alert while opening a .xls file using Office 2007/2010

跟風遠走 提交于 2019-12-02 21:33:31

问题


I am working on a struts based web application. In that application, we generate and download xls file from Jsp. In Jsp file and web.xml, I have set the content-type as "application/vnd.ms-excel"

it seems xls files generated by the jsp pages are not real excel files, but a text format that is understood by the MS Excel. Hence excel opens the files and displays the output similar to excel files saved by MS Excel. Since newer versions of MS Office 2007/2010 checks the file extension and the content inside the file, they issue a warning that the file format does not match with the content.

To get rid of the warning how can i ensure that the generated xls is real office excel file .

Please help.


回答1:


For future readers who might need this... Excel will complain anyway, even if your excel file is 'correct', as long as its structure doesn't properly match the extension. So if you're saving as an .XLS, it expects to see the classic excel file. The popup you are getting is because of the new security feature in Office 2007, called Extension Hardening and you can disable it if you want - either manually in the registry, or you can save the patch to a .REG file and share it to you clients etc.

Save those 2 line below into a GiveItSomeName.reg file, which you can then email to your clients and tell them to execute it.

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


来源:https://stackoverflow.com/questions/5727106/getting-extension-checkhardening-alert-while-opening-a-xls-file-using-office

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!