2018-06-03 22:26:41 +08:00

147 lines
4.5 KiB
Plaintext

<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/IncludeBegin.jsp"%>
<head>
<title>文档预览</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
//获得页面参数
String sEDocNo = CurPage.getParameter("EDocNo");
String sDocType = CurPage.getParameter("DocType");
String sFilePath = CurPage.getParameter("FilePath");
String sFileName = CurPage.getParameter("FileName");
String sDefFileName = CurPage.getParameter("DefFileName");
if(sEDocNo==null) sEDocNo="";
if(sDocType==null) sDocType="";
if(sFilePath==null) sFilePath="";
if(sFileName==null) sFileName="";
if(sDefFileName==null) sDefFileName="";
String sRightType = CurPage.getParameter("RightType");
String sWebAddress = "http://" + request.getServerName() + ":" + request.getServerPort()+sWebRootPath;
//文档保护密码,根据实际情况修改
String sProtectPWD = "SZPABPASSWORDHT001";
%>
<script ID=clientEventHandlersJS type="text/javascript">
var fileType;
var extension;
var sWebAddress = "<%=sWebAddress%>";
var dso;
function command_onclick() {
eval(document.all.commandtext.value);
}
function doSave(){
dso.ProtectDoc(1,1,"<%=sProtectPWD%>"); //添加文档保护
//保存为XML文件
var sTempFile = dso.GetTempFilePath();
var today = new Date();
var sTempFileName = sTempFile.substring(0,sTempFile.lastIndexOf("\\")+1)+Math.abs(Math.sin(today.getTime()))+".doc";
dso.SaveAs(sTempFileName,11); //11:xml,12:zip
//初始化Http引擎
dso.HttpInit();
//增加Post变量
dso.HttpAddPostString("EDocNo","<%=sEDocNo%>");
dso.HttpAddPostString("DocType","<%=sDocType%>");
dso.HttpAddPostString("FilePath","<%=sFilePath%>");
dso.HttpAddPostString("FileName","<%=sFileName%>");
//dso.HttpAddPostString("DefFileName","<%=sDefFileName%>");
//上传打开的文件
//dso.HttpAddPostCurrFile("FileData", "");
//dso.HttpAddPostCurrFile("File", "");
//上传XML文件
dso.HttpAddPostFile("xmltemplate",sTempFileName);
//执行上传动作
var sReturn = dso.HttpPost(sWebAddress+"/AppConfig/EDoc/EDocManage/DSOFramer/EDocEditUpload.jsp?CompClientID=<%=CurComp.getClientID()%>");
dso.DeleteLocalFile(sTempFileName);
dso.ProtectDoc(0,1,"<%=sProtectPWD%>"); //解除文档保护
if(sReturn.indexOf("EDocEditUpload_is_failure")>-1)
alert("保存失败.");
else
alert("保存成功.");
}
/**
* 弹出打印
*/
function doPrint(){
dso.ShowDialog(4);
}
/**
* 打印预览
*/
function printPreview(){
dso.PrintPreView();
}
/**
* 页面设置
*/
function pageSetup(){
dso.ShowDialog(5);
}
/**
* 插入文字
*/
function setText(text){
var obj;
obj = new Object(dso.ActiveDocument);
if(obj !=null){
obj.Application.Selection.TypeText(text);
delete obj;
}
}
function FramerControl1_NotifyCtrlReady() {
//alert("事件 NotifyCtrlReady 触发 ");
extension = "<%=sFileName%>".substring("<%=sFileName%>".lastIndexOf(".")+1);
if(extension=="xls"||extension=="xlsx"){
fileType = "Excel.Sheet";
}else if(extension=="doc"||extension=="docx"){
fileType = "Word.Document";
}
dso = document.getElementById("FramerControl1");
if("<%=sRightType%>"=="ReadOnly"){
dso.Toolbars = false;
}
dso.SetMenuDisplay(0); //设置菜单显示情况, 尤其屏蔽保存菜单
dso.Caption = "电子合同在线编辑";
dso.Open(sWebAddress+"/AppConfig/EDoc/EDocManage/DSOFramer/EDocEditDownload.jsp?FilePath=<%=sFilePath%>&CompClientID=<%=CurComp.getClientID()%>",false,fileType);
dso.ProtectDoc(0,1,"<%=sProtectPWD%>"); //解除文档保护
}
function FramerControl1_Close(){
dso.Close();
}
</script>
</head>
<body onload="FramerControl1_NotifyCtrlReady()" onunload="FramerControl1_Close()">
<table bgColor="#0000FF" border="0" cellPadding="4" cellSpacing="1" width="98%">
<tr bgColor=#ffffff>
<td width="100%" height="100%" align=center>
<form>
<object classid="clsid:00460182-9E5E-11D5-B7C8-B8269041DD57" id="FramerControl1" style="left: 0px; top: 0px; width: 100%; height: 750px"
codeBase="<%=sWebAddress%>/AppConfig/EDoc/EDocManage/DSOFramer/dsoframer.cab#version=2,3,0,1">
<param name="_ExtentX" value="6350">
<param name="_ExtentY" value="6350">
<param name="BorderColor" value="-2147483632">
<param name="BackColor" value="-2147483643">
<param name="ForeColor" value="-2147483640">
<param name="TitlebarColor" value="-2147483635">
<param name="TitlebarTextColor" value="-2147483634">
<param name="BorderStyle" value="1">
<param name="Titlebar" value="0">
<param name="Toolbars" value="1">
<param name="Menubar" value="0">
</object>
</form>
</td>
</tr>
</table>
</body>
<%@ include file="/IncludeEnd.jsp"%>