<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Issue_View.aspx.cs" Inherits="TotCms.Web.Office.Document.Issue_View" %>
<!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="../ActiveX/docfun.js" type="text/javascript"></script>
  <!-- --------------------=== 调用Weboffice初始化方法 ===--------------------- -->
<script language="javascript" event="NotifyCtrlReady" for="WebOffice1">
/****************************************************
*
*	在装载完Weboffice(执行<object>...</object>)
*	控件后执行 "WebOffice1_NotifyCtrlReady"方法
*
****************************************************/
	WebOffice1_NotifyCtrlReady()
</script>

<script language="javascript" event="NotifyWordEvent(eventname)" for="WebOffice1">
<!--
 WebOffice1_NotifyWordEvent(eventname)
//-->
</script>

<script language="javascript">
  /****************************************************
  *
  *		控件初始化WebOffice方法
  *
  ****************************************************/
  function WebOffice1_NotifyCtrlReady() {
    document.all.WebOffice1.OptionFlag |= 128;
    // 新建文档
    document.all.WebOffice1.LoadOriginalFile("<%=GetUrl() %>/Doc/<%=GetId() %>.doc", "doc");

  }
  var flag = false;
  function menuOnClick(id) {
    var id = document.getElementById(id);
    var dis = id.style.display;
    if (dis != "none") {
      id.style.display = "none";

    } else {
      id.style.display = "block";
    }
  }
  /****************************************************
  *
  *		接收office事件处理方法
  *
  ****************************************************/
  var vNoCopy = 0;
  var vNoPrint = 0;
  var vNoSave = 0;
  var vClose = 0;
  function no_copy() {
    vNoCopy = 1;
  }
  function yes_copy() {
    vNoCopy = 0;
  }


  function no_print() {
    vNoPrint = 1;
  }
  function yes_print() {
    vNoPrint = 0;
  }


  function no_save() {
    vNoSave = 1;
  }
  function yes_save() {
    vNoSave = 0;
  }
  function EnableClose(flag) {
    vClose = flag;
  }
  function CloseWord() {

    document.all.WebOffice1.CloseDoc(0);
  }

  function WebOffice1_NotifyWordEvent(eventname) {
    if (eventname == "DocumentBeforeSave") {
      if (vNoSave) {
        document.all.WebOffice1.lContinue = 0;
        alert("此文档已经禁止保存");
      } else {
        document.all.WebOffice1.lContinue = 1;
      }
    } else if (eventname == "DocumentBeforePrint") {
      if (vNoPrint) {
        document.all.WebOffice1.lContinue = 0;
        alert("此文档已经禁止打印");
      } else {
        document.all.WebOffice1.lContinue = 1;
      }
    } else if (eventname == "WindowSelectionChange") {
      if (vNoCopy) {
        document.all.WebOffice1.lContinue = 0;
        //alert("此文档已经禁止复制");
      } else {
        document.all.WebOffice1.lContinue = 1;
      }
    } else if (eventname == "DocumentBeforeClose") {
      if (vClose == 0) {
        document.all.WebOffice1.lContinue = 0;
      } else {
        //alert("word");
        document.all.WebOffice1.lContinue = 1;
      }
    }
    //alert(eventname); 
  }  
</script>
</head>
<body>
    <form id="form1" runat="server">
    <!-- -----------------------------== 装载weboffice控件 ==--------------------------------- -->
        <script src="../ActiveX/LoadWebOffice.js" type="text/javascript"></script>
        <!-- --------------------------------== 结束装载控件 ==----------------------------------- -->  
    </form>
</body>
</html>
