有没有办法自动从html文件或active x中检测excel版本?

发布于 2024-11-28 04:13:34 字数 1152 浏览 1 评论 0原文

我有一个以 html 和 excel 的奇怪组合运行的工作流程,当我来这里工作时已经完成了,所以我无法重新启动该流程,这是交易: 在流程的某个步骤之后,通过电子邮件发送一个 html 文件,该文件包含一个活动 x,它将使用一些给定的参数自动打开 excel,但是即使一切似乎都是使用参数构建的,excel 的路径是硬编码的,我们从来没有遇到了一个问题,因为每个人都使用 Excel 2003,而且几乎每个人都有相同的图像,因此路径是相同的,但现在一些用户(高层管理人员)将迁移到 Office 2010。因此我需要一种方法来自动检测卓越通过 active x 更改版本,以便 html 文件将打开正确的 excel 版本。

有什么想法吗?

谢谢!

编辑 这就是我用的:

<script language="JavaScript">

function LoadVendor()
{
 var vendor = document.getElementById("vendor").value;
 document.getElementById("vend").innerHTML=vendor; 

 var BIDnum = document.getElementById("BIDnumber").value;
 document.getElementById("BIDnum").innerHTML=BIDnum; 
}

function openExcelDocPath()
{
 var shell = new ActiveXObject("WScript.Shell");
 var excelexe = document.getElementById("excelexe").value;
 var excelprg = document.getElementById("excelprg").value;
 var vendor = document.getElementById("vendor").value;
 document.getElementById("vend").innerHTML=vendor;

 shell.run( "\"" + excelexe + "\"" + excelprg , 1, false );

 try{objExcel.comaddins("SAS.OIBootStrap.Connect").connect = "False"; }
  catch(err)
  {  }
}

</script>

I have a workflow process that runs in weird combination of html and excel, this was already done when I came to work here so I'm no able to restart the process, well here is the deal:
After a certain step on the flow, a html file is sent through email, this file contains an active x that will automatically open excel with some given parameters, however even though everything seems to build with parameters the path for excel is hardcoded, we never had an issue with this as everyone was using Excel 2003 and pretty much everyone had the same image so the path was the same, but now some users (top management) will be migrating to office 2010. Therefore I need a way to automatically detect the excel version through the active x so the html file will open the correct excel version.

Any ideas?

Thanks!

EDIT
this is what I use:

<script language="JavaScript">

function LoadVendor()
{
 var vendor = document.getElementById("vendor").value;
 document.getElementById("vend").innerHTML=vendor; 

 var BIDnum = document.getElementById("BIDnumber").value;
 document.getElementById("BIDnum").innerHTML=BIDnum; 
}

function openExcelDocPath()
{
 var shell = new ActiveXObject("WScript.Shell");
 var excelexe = document.getElementById("excelexe").value;
 var excelprg = document.getElementById("excelprg").value;
 var vendor = document.getElementById("vendor").value;
 document.getElementById("vend").innerHTML=vendor;

 shell.run( "\"" + excelexe + "\"" + excelprg , 1, false );

 try{objExcel.comaddins("SAS.OIBootStrap.Connect").connect = "False"; }
  catch(err)
  {  }
}

</script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2024-12-05 04:13:34

我不是 100% 同意你的追求,但你可以完全放弃物理路径;

var Excel = new ActiveXObject("excel.application");
Excel.Visible = true;
Excel.Workbooks.Add(); //to keep resident if you want interactivity
//can open something here ...

//or just get the path/version
alert( Excel.version );
alert( Excel.path );

//to kill
//Excel.Quit();
//Excel = null;

I'm not 100% on what your after but you could drop the physical path entirely;

var Excel = new ActiveXObject("excel.application");
Excel.Visible = true;
Excel.Workbooks.Add(); //to keep resident if you want interactivity
//can open something here ...

//or just get the path/version
alert( Excel.version );
alert( Excel.path );

//to kill
//Excel.Quit();
//Excel = null;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文