0

我需要一个建议来澄清我的想法。现在我正在使用 Angularjs 作为前端框架的 ASP.NET MVC5 中的 Web 应用程序。有没有办法使用任何脚本语言(如 jquery、ajax、angularjs 等)打开客户端应用程序(如 MS Word/Outlook)?

4

2 回答 2

2

是的,您可以使用 . 打开任何 MS-WORD 文档ActiveXObject
以下是在网页上打印文件数据的示例代码。

var w=new ActiveXObject(‘Word.Application’);
if (w != null)

{

w.Visible = true; //set to false to stop the Word document from opening

obj=w.Documents.Open("C:\\blank.doc"); //this can be any location on your PC, not just C:

docText = obj.Content;

w.Selection.TypeText("Hello world!");

w.Documents.Save();

document.write(docText);//Print on webpage

有关更多信息,您可以参考此处。

于 2019-06-12T05:17:20.293 回答
1

一般来说,不会,因为这将是一个巨大的安全漏洞并导致病毒和恶意软件的传播。

在某些特定情况下,您已经可以控制用户的计算机,您也许可以做到(例如,Strom 所说的带有受信任站点的 Internet Explorer)。

但实际上并不值得追求这样的选择,因为它们一直被浏览器供应商积极关闭。

于 2019-06-12T05:52:25.140 回答