使用javascript从浏览器打开/编辑/保存Excel工作表 [英] Open/edit/save excel sheet from browser using javascript

查看:146
本文介绍了使用javascript从浏览器打开/编辑/保存Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道怎样才能

使用javascript从浏览器打开/编辑/保存excel表,而无需获取excel popup请求打开或保存

什么我试过了:

< pre> var Excel = new ActiveXObject(Excel.Application);
Excel.Visible = true;
Excel.Workbooks.Open(store_funnel.xlsx);

解决方案

引用:

使用javascript从浏览器打开/编辑/保存excel表而不需要打开或保存excel popup

引用:

我实际上需要打开一个本地excel文件



出于安全考虑,今天的浏览器禁止这种行为。

Internet Explorer可能是唯一一个在activex的帮助下允许此活动的人,问题是默认情况下,activex被停用,IE现在不那么受欢迎。



我担心你必须找到另一种方式。


 var newwindow = window.open(url of .xls,window1, ); 





确保'目录'(755)和'文件(644)的权限'访问权限至少为所有人阅读您希望下载的.xls的用户。


这适用于IE:



< HTML> 

< body>

< form name =form1>
< input type = button onClick =test()value =Open File>
< br>< br>
< / form>

< script type =text / javascript>
函数test(){
var Excel = new ActiveXObject(Excel.Application);
Excel.Visible = true;
Excel.Workbooks.Open(http://go.microsoft.com/fwlink/?LinkID=521962);
}
< / script>
< / body>
< / html>





您可能还需要弄乱安全性但它会单独打开Excel电子表格窗口..


I would like to know how can i

open/edit/save excel sheet from browser using javascript without getting the excel popup asking to open or save

What I have tried:

<pre>var Excel = new ActiveXObject("Excel.Application");
        Excel.Visible = true;
        Excel.Workbooks.Open("store_funnel.xlsx");

解决方案

Quote:

open/edit/save excel sheet from browser using javascript without getting the excel popup asking to open or save

Quote:

I actually need to open a local excel file


This kind of action is forbidden by today's browsers for security reasons.
Internet Explorer is probably the only one that allow this activity with the help of an activex, the problem is that by default, activex is deactivated and IE is not so popular these days.

I fear you have to find another way.


var newwindow=window.open("url of .xls","window1","");



Make sure that the permissions for 'directory' (755) and 'file (644)' access are set to at least 'read' for all users for the .xls you wish to download.


This works in IE:

<html>

  <body>

    <form name="form1">
      <input type=button onClick="test()" value="Open File">
      <br><br>
    </form>

    <script type="text/javascript">
      function test() {
        var Excel = new ActiveXObject("Excel.Application");
        Excel.Visible = true;
        Excel.Workbooks.Open("http://go.microsoft.com/fwlink/?LinkID=521962");
      }
    </script>
  </body>
</html>



You might also need to mess with the Security but it opens the Excel spreadsheet in a separate window..


这篇关于使用javascript从浏览器打开/编辑/保存Excel工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆