NTKO文档在线编辑(待补)
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainBody.aspx.cs" Inherits="JG.SZXY.IntegratedOffice.Module.Logistics.FireFight.MainBody" %>
<%@ Import Namespace="JG.SZXY.IntegratedOffice.Ajax.HomePage" %>
<%@ Register src="../../../UControl/TifShow.ascx" tagname="TifShow" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>收文正文</title>
<script src="/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/Scripts/jquery.form.js"></script>
<script type="text/javascript" src="/Scripts/Common/NewCommon.js"></script>
<script src="/Scripts/jquery-easyui-1.3.3/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<link href="/Scripts/jquery-easyui-1.3.3/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="/Scripts/jquery-easyui-1.3.3/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="/Style/Global.css" rel="stylesheet" type="text/css" />
<link href="/Style/PageNavigation.css" rel="stylesheet" type="text/css" />
<link href="/Scripts/upload/uploadify.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/upload/swfobject.js" type="text/javascript"></script>
<script src="/Scripts/upload/jquery.uploadify.min.js" type="text/javascript"></script>
<script src="/Scripts/officecontrol/ntko_client.js" type="text/javascript"></script>
<script type="text/javascript">
var noChangePath = "";
$(function () {
noChangePath = unescape('<%= Request["path"] %>');
if (<%= IsOpenDoc %> == "1") {
fOnLoad(noChangePath);
}
});
//根据地址打开PDF
function fOnLoad(path) {
NTKO.Load();
var fullname = path;
if (fullname == "") {
NTKO.CreateNew('1');
} else {
setTimeout("timeoutFunc('" + path + "')", 2000);
}
}
function timeoutFunc(path) {
NTKO.OpenFileName(path);
}
$(function () {
document.getElementById("objpdf").src = '<%= HomePageData.WebServerHttp %><%= Request["path"] %>';
parent.$("#frmmainbody").css("height", $("#objpdf").height() + 50);
$("#divpdf").css("display", "block");
$("#divtif").css("display", "none");
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:LinkButton ID="lbtnloadtif" runat="server" OnClick="LoadTif"></asp:LinkButton>
<input type="hidden" id="hidrealpath" runat="server" />
<input type="hidden" id="hidextension" runat="server" />
<div id="divpdf" style="display: none; width: 1024px; margin-left: auto; margin-right: auto;">
<object id="objpdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="600" border="0">
<param name="_Version" value="65539">
<param name="_ExtentX" value="20108">
<param name="_ExtentY" value="10866">
<param name="_StockProps" value="0">
<param name="SRC" value="">
</object>
</div>
<div id="divtif" style="display: none; width: 1024px; margin-left: auto; margin-right: auto;">
<uc1:TifShow ID="MyTifShow" runat="server" />
</div>
<div id="divceb" style="display: none; text-align: center;">
<div style="padding: 5px; width: 98%; height: 600px; text-align: center; margin-left: auto; margin-right: auto;">
<iframe id="cebUrlIFrame" src="about:blank" frameborder="0" scrolling="no" style="width: 98%; height: 600px;"></iframe>
</div>
</div>
<div id="divZW" style="text-align: center; display: none;">
<div id="officecontrol" style="padding: 5px; width: 1024px; height: 600px; text-align: center; margin-left: auto; margin-right: auto;">
<!--引用NTKO OFFICE文档控件-->
<!-- 用来产生编辑状态的ActiveX控件的JS脚本-->
<!-- 因为微软的ActiveX新机制,需要一个外部引入的js-->
<script src="../../../Scripts/officecontrol/ntkoofficecontrol.js" type="text/javascript"></script>
<!--控件事件代码开始-->
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(cmd,canceled);">
// alert(cmd);
CancelLastCommand=true;
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentClosed();">
NTKO.SetFileOpenedOrClosed(false);
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj);">
//saved属性用来判断文档是否被修改过,文档打开的时候设置成ture,当文档被修改,自动被设置为false,该属性由office提供.
NTKO.TANGER_OCX_OBJ.ActiveDocument.Saved = true;
if(2==NTKO.TANGER_OCX_OBJ.DocType)
{
try{
NTKO.TANGER_OCX_OBJ.ActiveDocument.Application.ActiveWorkbook.Saved=true;
}catch(e)
{
alert("错误:" + err.number + ":" + err.description);
}
}
NTKO.EnableFileNewMenu(false);
NTKO.SetFileOpenedOrClosed(true);//设置文档状态值
NTKO.SetShowRevisions(false); //设置是否显示痕迹
NTKO.SetReadOnly(false);
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="BeforeOriginalMenuCommand(TANGER_OCX_str,TANGER_OCX_obj);">
alert("BeforeOriginalMenuCommand事件被触发");
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(TANGER_OCX_str,TANGER_OCX_obj);">
if (TANGER_OCX_str == 3)
{
alert("不能保存!");
CancelLastCommand = true;
}
</script>
<!--控件事件代码结束-->
</div>
</div>
</form>
</body>
</html>
<%@ Import Namespace="JG.SZXY.IntegratedOffice.Ajax.HomePage" %>
<%@ Register src="../../../UControl/TifShow.ascx" tagname="TifShow" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>收文正文</title>
<script src="/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/Scripts/jquery.form.js"></script>
<script type="text/javascript" src="/Scripts/Common/NewCommon.js"></script>
<script src="/Scripts/jquery-easyui-1.3.3/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<link href="/Scripts/jquery-easyui-1.3.3/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="/Scripts/jquery-easyui-1.3.3/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="/Style/Global.css" rel="stylesheet" type="text/css" />
<link href="/Style/PageNavigation.css" rel="stylesheet" type="text/css" />
<link href="/Scripts/upload/uploadify.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/upload/swfobject.js" type="text/javascript"></script>
<script src="/Scripts/upload/jquery.uploadify.min.js" type="text/javascript"></script>
<script src="/Scripts/officecontrol/ntko_client.js" type="text/javascript"></script>
<script type="text/javascript">
var noChangePath = "";
$(function () {
noChangePath = unescape('<%= Request["path"] %>');
if (<%= IsOpenDoc %> == "1") {
fOnLoad(noChangePath);
}
});
//根据地址打开PDF
function fOnLoad(path) {
NTKO.Load();
var fullname = path;
if (fullname == "") {
NTKO.CreateNew('1');
} else {
setTimeout("timeoutFunc('" + path + "')", 2000);
}
}
function timeoutFunc(path) {
NTKO.OpenFileName(path);
}
$(function () {
document.getElementById("objpdf").src = '<%= HomePageData.WebServerHttp %><%= Request["path"] %>';
parent.$("#frmmainbody").css("height", $("#objpdf").height() + 50);
$("#divpdf").css("display", "block");
$("#divtif").css("display", "none");
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:LinkButton ID="lbtnloadtif" runat="server" OnClick="LoadTif"></asp:LinkButton>
<input type="hidden" id="hidrealpath" runat="server" />
<input type="hidden" id="hidextension" runat="server" />
<div id="divpdf" style="display: none; width: 1024px; margin-left: auto; margin-right: auto;">
<object id="objpdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="600" border="0">
<param name="_Version" value="65539">
<param name="_ExtentX" value="20108">
<param name="_ExtentY" value="10866">
<param name="_StockProps" value="0">
<param name="SRC" value="">
</object>
</div>
<div id="divtif" style="display: none; width: 1024px; margin-left: auto; margin-right: auto;">
<uc1:TifShow ID="MyTifShow" runat="server" />
</div>
<div id="divceb" style="display: none; text-align: center;">
<div style="padding: 5px; width: 98%; height: 600px; text-align: center; margin-left: auto; margin-right: auto;">
<iframe id="cebUrlIFrame" src="about:blank" frameborder="0" scrolling="no" style="width: 98%; height: 600px;"></iframe>
</div>
</div>
<div id="divZW" style="text-align: center; display: none;">
<div id="officecontrol" style="padding: 5px; width: 1024px; height: 600px; text-align: center; margin-left: auto; margin-right: auto;">
<!--引用NTKO OFFICE文档控件-->
<!-- 用来产生编辑状态的ActiveX控件的JS脚本-->
<!-- 因为微软的ActiveX新机制,需要一个外部引入的js-->
<script src="../../../Scripts/officecontrol/ntkoofficecontrol.js" type="text/javascript"></script>
<!--控件事件代码开始-->
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(cmd,canceled);">
// alert(cmd);
CancelLastCommand=true;
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentClosed();">
NTKO.SetFileOpenedOrClosed(false);
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnDocumentOpened(TANGER_OCX_str,TANGER_OCX_obj);">
//saved属性用来判断文档是否被修改过,文档打开的时候设置成ture,当文档被修改,自动被设置为false,该属性由office提供.
NTKO.TANGER_OCX_OBJ.ActiveDocument.Saved = true;
if(2==NTKO.TANGER_OCX_OBJ.DocType)
{
try{
NTKO.TANGER_OCX_OBJ.ActiveDocument.Application.ActiveWorkbook.Saved=true;
}catch(e)
{
alert("错误:" + err.number + ":" + err.description);
}
}
NTKO.EnableFileNewMenu(false);
NTKO.SetFileOpenedOrClosed(true);//设置文档状态值
NTKO.SetShowRevisions(false); //设置是否显示痕迹
NTKO.SetReadOnly(false);
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="BeforeOriginalMenuCommand(TANGER_OCX_str,TANGER_OCX_obj);">
alert("BeforeOriginalMenuCommand事件被触发");
</script>
<script type="text/javascript" language="JScript" for="TANGER_OCX" event="OnFileCommand(TANGER_OCX_str,TANGER_OCX_obj);">
if (TANGER_OCX_str == 3)
{
alert("不能保存!");
CancelLastCommand = true;
}
</script>
<!--控件事件代码结束-->
</div>
</div>
</form>
</body>
</html>