146 lines
4.3 KiB
HTML
146 lines
4.3 KiB
HTML
<html>
|
|
<head>
|
|
<meta content="IE=10" http-equiv="X-UA-Compatible" />
|
|
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
|
|
<title>首页 - OFFICE文档控件演示示例</title>
|
|
<link href="./ntkoStyle.css" rel="stylesheet" type="text/css" />
|
|
<script type="text/javascript" src="./jquery.js"></script>
|
|
<script type="text/javascript" src="./ntko.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
var cmd; //命令类型
|
|
var DocfileCode;//doc id
|
|
var PDFfileCode;//pdf id
|
|
var readonly;//是否可编辑
|
|
var savePDF;//是否保存 pdf
|
|
var datatext;
|
|
var datavalue;
|
|
function getQueryString(name) {
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
var r = window.location.search.substr(1).match(reg);
|
|
if (r != null) return unescape(r[2]);
|
|
|
|
return null;
|
|
|
|
}
|
|
function CurentTime() {
|
|
var now = new Date();
|
|
|
|
var year = now.getFullYear(); //年
|
|
var month = now.getMonth() + 1; //月
|
|
var day = now.getDate(); //日
|
|
|
|
var hh = now.getHours(); //时
|
|
var mm = now.getMinutes(); //分
|
|
var ss = now.getSeconds(); //分
|
|
|
|
var clock = year + "-";
|
|
|
|
if(month < 10)
|
|
clock += "0";
|
|
|
|
clock += month + "-";
|
|
|
|
if(day < 10)
|
|
clock += "0";
|
|
|
|
clock += day + " ";
|
|
|
|
if(hh < 10)
|
|
clock += "0";
|
|
|
|
clock += hh + ":";
|
|
if (mm < 10) clock += '0';
|
|
clock += mm + ":";
|
|
if (ss < 10) clock += '0';
|
|
clock += ss;
|
|
return(clock);
|
|
}
|
|
|
|
//在子页面定义的向父页面回传值的方法,方法名可以自定义
|
|
function ntkoSendDataToParentPage()
|
|
{
|
|
var varData = new Array();
|
|
varData.push(ntko.docsize);
|
|
varData.push(CurentTime());
|
|
// ntkoBrowser.ntkoSetReturnValueToParentPage("OnData","dddd");
|
|
}
|
|
function ntkoDataToChild(data){
|
|
ntko.SetBookmarkValue("ntko",data);
|
|
var ntkoc= ntko.ActiveDocument.bookMarks.count;
|
|
for(var i=1;i<=ntkoc;i++){
|
|
var ntkoname= ntko.ActiveDocument.bookMarks.item(i).name;
|
|
if(ntkoname=="ntko"){
|
|
ntko.ActiveDocument.bookMarks.item(i).select();
|
|
ntko.ActiveDocument.Application.Selection.Font.Color=255;
|
|
ntko.ActiveDocument.Application.Selection.Font.Bold=9999998;
|
|
ntko.ActiveDocument.Application.Selection.Font.Size = 16;
|
|
}
|
|
}
|
|
}
|
|
function ntkoGetParentData(data){//该方法用于接收父页面传递的值
|
|
if(data=="Save"){
|
|
var DOCmsg=ntko.SaveToURL("/api/core-service-ebtp-updownload/v1/attachment/upload/","file","businessId="+DocfileCode+"&file="+DocfileCode,DocfileCode+".doc");
|
|
if(JSON.parse(DOCmsg).success){
|
|
ntkoBrowser.ntkoSetReturnValueToParentPage("DOCData","success");
|
|
} else{
|
|
ntkoBrowser.ntkoSetReturnValueToParentPage("DOCData","error");
|
|
}
|
|
}
|
|
if(data=="SavePDF"&&savePDF=="1"){
|
|
ntko.PublishAsPDFToURL("/api/core-service-ebtp-updownload/v1/attachment/upload/","file","businessId="+PDFfileCode+"&file="+PDFfileCode,PDFfileCode+".pdf")
|
|
}
|
|
}
|
|
function ntkocloseparentpage(){
|
|
ntkoGetParentData();
|
|
ntkoSendDataToParentPage();
|
|
|
|
}
|
|
</script>
|
|
|
|
|
|
</head>
|
|
|
|
<!--AfterPublishAsPDFToURL-->
|
|
|
|
<body onload="readonly=getQueryString('readonly');DocfileCode=getQueryString('DocfileCode');PDFfileCode=getQueryString('PDFfileCode');savePDF=getQueryString('savePDF');init(readonly,DocfileCode);" onbeforeunload="ntkocloseparentpage()">
|
|
<script language="JScript" for="TANGER_OCX" event="OnCustomButtonOnMenuCmd(btnPos,btnCaption,btnCmdid)">
|
|
|
|
</script>
|
|
<script language="JScript" for="TANGER_OCX" event="AfterOpenFromURL(doc, statusCode)">
|
|
if(ntko.StatusCode!=0){
|
|
ntko.CreateNew("Word.Document");
|
|
};
|
|
if (readonly != "false"){
|
|
ntko.SetReadOnly(true);//只读
|
|
}else{
|
|
ntko.SetReadOnly(false);//可编辑
|
|
}
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript" for="TANGER_OCX" event="OnDocumentOpened(File, Document)" >
|
|
<div class="divTopInnerNtko">
|
|
<span>商城3.0</span>
|
|
</div>
|
|
</script>
|
|
<div class="divTop">
|
|
<div class="divTopInner">
|
|
<div class="divTopInnerCaption">商城3.0</div>
|
|
</div>
|
|
</div>
|
|
<div class="divBody">
|
|
<script type="text/javascript" src="./ntkoofficecontrol.min.js"></script>
|
|
</div>
|
|
</body>
|
|
<script language="JScript" for="TANGER_OCX" event="AfterPublishAsPDFToURL(ret,code)">
|
|
if(JSON.parse(ret).success){
|
|
ntkoBrowser.ntkoSetReturnValueToParentPage("PDFData","success");
|
|
} else{
|
|
ntkoBrowser.ntkoSetReturnValueToParentPage("PDFData","error");
|
|
}
|
|
</script>
|
|
|
|
</html>
|