当前位置:编程学习 > JS >>

在 IE 中调用 javascript 打开 Excel 表

答案:<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN“>
<HTML>
<HEAD>
<META http-equiv=Content-Type content=“text/html; charset=utf-8“>
<TITLE>打开Excel表</TITLE>

</HEAD>
<BODY>

<input name=“shanghai“ type=“button“ class=“but“ id=“shanghai“ onClick=“StartExcel('上海')“ value=“上海店“>

<SCRIPT LANGUAGE=“Javascript“>
var idTmr = ““;

function StartExcel(strFileName)
{
var oExcel;
var oWorkbook;
var strAllName;
oExcel = new ActiveXObject(“Excel.Application“);
//if(strFileName=null || strFileName=““)
//{return;
//}
strAllName=“\\\\ep-hgh\\Top30销控表\\TOP30招商续约销控表-“+strFileName+“.xls“;
oExcel.Workbooks.Open(strAllName);
//oExcel.Workbooks.Open(“file://ep-hgh/Top30销控表/TOP30招商续约销控表-上海.xls“);
oExcel.DisplayAlerts = false;
oExcel.Visible = true;
//oExcel.Quit();
//oExcel = null;
//防EExcel死进程的关键!!必须!!!downmoon严重声明
idTmr = window.setInterval(“Cleanup();“,1000);
}

function Cleanup() {
window.clearInterval(idTmr);
CollectGarbage();
}

</SCRIPT>

</BODY>
</HTML>

上一个:URI、URL和URN之间的区别与联系
下一个:js版本A*寻路算法

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,