简体   繁体   English

在读取XLS / XLSX本地文件时,如何使用IE的JavaScript代码启用未标记为安全的ActiveX控件

[英]How to enable ActiveX controls not marked as safe using javascript code for IE, while reading XLS/XLSX local files

without enabling manually Internet Explorer -> Internet Control Panel -> Security Page -> Internet Zone -> "Initialize and script ActiveX controls not marked as safe" must be “Enabled” has to be done using javascript code. 无需手动启用Internet Explorer-> Internet控制面板->安全页面-> Internet区域->“初始化并标记未标记为安全的ActiveX控件”必须使用javascript代码来“启用”。

 var ex; try { ex = new ActiveXObject("Excel.Application"); } catch (e) { alert('Your browser does not support the Activex object.\\nPlease switch to Internet Explorer.'); } var ef = ex.Workbooks.Open(oFileIn.value); var es = ex.Worksheets(so); var rs = parseInt(ho, 10); var cs = parseInt(co, 10); var ce = cs + parseInt(hco, 10) - 1; var re = rs + parseInt(ro, 10); 

If I understand your question, you want to script an ActiveX not marked as safe. 如果我理解您的问题,则需要编写一个未标记为安全的ActiveX脚本。 You can't. 你不能 This is exactly the purpose of this setting, to block execution of scripts not explicitly allowed by the user. 这正是此设置的目的,目的是阻止用户未明确允许的脚本执行。

As a solution, you could run a powershell script in the client machine to mark the desired ActiveX as safe. 作为解决方案,您可以在客户端计算机上运行Powershell脚本以将所需的ActiveX标记为安全。

https://blogs.technet.microsoft.com/fdcc/2011/11/03/enabling-initialize-and-script-activex-controls-not-marked-as-safe-in-any-zone-can-get-you-hurt-bad/ https://blogs.technet.microsoft.com/fdcc/2011/11/03/enabling-initialize-and-script-activex-controls-not-marked-as-safe-in-any-zone-can-get-你真坏/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM