//debugger;
try {
if (this.WordApp == null) {
this.WordApp = new ActiveXObject("Word.Application");
try {
this.WordApp.Application.Caption = key;
} catch (e) {
}
this.WordApp.Application.Visible = true;
this.WordApp.DisplayAlerts = false;
wpsoroffice = "office";
} else if (!this.WordApp.Application)
this.WordApp = null;
} catch (e) {
this.WordApp = null;
}
if (this.WordApp == null) {
this.WordApp = new ActiveXObject("WPS.Application");
try {
this.WordApp.Application.Caption = key;
} catch (e) {
}
this.WordApp.Application.Visible = true;
this.WordApp.DisplayAlerts = false;
wpsoroffice = "wps";
}/** * 动态添加activex否则启动。 * */function CreateYFToolSocket_rfid(){var rfid_ocx = document.getElementById("rfid_ocx");if(!rfid_ocx){var divApplet = document.createElement("div");divApplet.innerHTML = '<OBJECT id="rfid_ocx" classid="clsid:1814628D-13BB-4794-A986-78212924E5F0" codebase="yfrfidtoolProj1.ocx#version=3,0,0,0"></OBJECT>';if(document.body)document.body.appendChild(divApplet);elsedocument.appendChild(divApplet);rfid_ocx = document.getElementById("rfid_ocx");}if(rfid_ocx){}else{return;}return rfid_ocx;}
function writeObject(){
var obj = document.getElementById("mydelphi");
if(!obj){
var divobj = document.createElement("div");
divobj.innerHTML = '<OBJECT id="mydelphi" classid="clsid:84864ABE-E805-436C-9683-F11C1BB72FC3" codebase="'+mainpath+'ActiveFormProj1.ocx#version=2,0,0,0" width=0 height=0 align=center hspace=0 vspace=0></OBJECT>';
if(document.body)
document.body.appendChild(divobj);
else
document.appendChild(divobj);
obj = document.getElementById("aaa");
}
return obj;
}var applet = document.getElementById("socketapplet");
if(!applet){
var divApplet = document.createElement("div");
divApplet.innerHTML = '<applet code="Applet" name="socketapplet"'
+'id="socketapplet" archive="'+mainpath+'appletweb.jar" width=0 height=0>';
+'<param name=hostAddr value="'+mainpath+'">'
+'</applet>';
if(document.body)
document.body.appendChild(divApplet);
else
document.appendChild(divApplet);
applet = document.getElementById("socketapplet");
}
return applet;
本文详细介绍了如何通过JavaScript实现WordApp和WPS应用的动态加载与代理技术,确保应用程序在不同环境下正常运行。通过判断当前环境,选择合适的Office应用实例,并配置其显示状态和警告提示,确保了程序的灵活性与兼容性。
1872

被折叠的 条评论
为什么被折叠?



