⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 documentedit.aspx

📁 iWEbOffice2006协同办公中间件
💻 ASPX
📖 第 1 页 / 共 3 页
字号:
}

//作用:VBA套红
function WebInsertVBA(){

	//画线
	var object=webform.WebOffice.WebObject;
	var myl=object.Shapes.AddLine(100,60,305,60)
	myl.Line.ForeColor=255;
	myl.Line.Weight=2;
	var myl1=object.Shapes.AddLine(326,60,520,60)
	myl1.Line.ForeColor=255;
	myl1.Line.Weight=2;

	//object.Shapes.AddLine(200,200,450,200).Line.ForeColor=6;
   	var myRange=webform.WebOffice.WebObject.Range(0,0);
	myRange.Select();

	var mtext="★";
	webform.WebOffice.WebObject.Application.Selection.Range.InsertAfter (mtext+"\n");
   	var myRange=webform.WebOffice.WebObject.Paragraphs(1).Range;
   	myRange.ParagraphFormat.LineSpacingRule =1.5;
   	myRange.font.ColorIndex=6;
   	myRange.ParagraphFormat.Alignment=1;
   	myRange=webform.WebOffice.WebObject.Range(0,0);
	myRange.Select();
	mtext="金格发[2003]154号";
	webform.WebOffice.WebObject.Application.Selection.Range.InsertAfter (mtext+"\n");
	myRange=webform.WebOffice.WebObject.Paragraphs(1).Range;
	myRange.ParagraphFormat.LineSpacingRule =1.5;
	myRange.ParagraphFormat.Alignment=1;
	myRange.font.ColorIndex=1;

	mtext="金格电子政务文件";
	webform.WebOffice.WebObject.Application.Selection.Range.InsertAfter (mtext+"\n");
	myRange=webform.WebOffice.WebObject.Paragraphs(1).Range;
	myRange.ParagraphFormat.LineSpacingRule =1.5;

	//myRange.Select();
	myRange.Font.ColorIndex=6;
	myRange.Font.Name="仿宋_GB2312";
	myRange.font.Bold=true;
	myRange.Font.Size=50;
	myRange.ParagraphFormat.Alignment=1;

	//myRange=myRange=webform.WebOffice.WebObject.Paragraphs(1).Range;
	webform.WebOffice.WebObject.PageSetup.LeftMargin=70;
	webform.WebOffice.WebObject.PageSetup.RightMargin=70;
	webform.WebOffice.WebObject.PageSetup.TopMargin=70;
	webform.WebOffice.WebObject.PageSetup.BottomMargin=70;
}

//作用:套用模版定稿
function WebInsertFile(){
  var mDialogUrl = "Template/TemplateForm.aspx";
  var mObject = new Object();
      mObject.Template = "";
      window.showModalDialog(mDialogUrl, mObject, "dialogHeight:200px; dialogWidth:360px;center:yes;scroll:no;status:no;");

  //判断用户是否选择模板
  if (mObject.Template==""){
    StatusMsg("取消套用模");
    return false;
  }else{
    //SaveDocument();    //保存当前编辑的文档
    webform.WebOffice.WebSetMsgByName("COMMAND","INSERTFILE");   //设置变量COMMAND="INSERTFILE",在WebLoadTemplate()时,一起提交到OfficeServer中     <参考技术文档>
    webform.WebOffice.Template=mObject.Template;                 //全局变量Template赋值,此示例读取服务器目录中模板,如读取数据库中模板,Template值为数据库中的模板编号,则上句代码不需要,如Template="1050560363767",模板名称为“Word公文模板”,注:模板中有要标签Content,区分大小写,可以自行修改
    if (webform.WebOffice.WebLoadTemplate()){                    //交互OfficeServer的OPTION="LOADTEMPLATE"
       //SetBookmarks("Title","关于中间件研发工作会议通知");     //填充模板其它基本信息,如标题,主题词,文号,主送机关等
       if (webform.WebOffice.WebInsertFile()){                   //填充公文正文   交互OfficeServer的OPTION="INSERTFILE"
         StatusMsg(webform.WebOffice.Status);
       }else{
         StatusMsg(webform.WebOffice.Status);
       }
    }else{
       StatusMsg(webform.WebOffice.Status);
    }
  }
}

//作用:保存定稿文件
function WebUpdateFile(){
  if (webform.WebOffice.WebUpdateFile()){                //交互OfficeServer的OPTION="UPDATEFILE",类似WebSave()或WebSaveVersion()方法
     StatusMsg(webform.WebOffice.Status);
  }else{
     StatusMsg(webform.WebOffice.Status);
  }
}



//打印份数控制
function WebCopysCtrlPrint(){
  var mCopies,objPrint;
  objPrint = webform.WebOffice.WebObject.Application.Dialogs(88);     //打印设置对话框
  if (objPrint.Display==-1){
    mCopies=objPrint.NumCopies;    //取得需要打印份数
    webform.WebOffice.WebSetMsgByName("COMMAND","COPIES");
    webform.WebOffice.WebSetMsgByName("OFFICEPRINTS",mCopies.toString());   //设置变量OFFICEPRINTS的值,在WebSendMessage()时,一起提交到OfficeServer中
    webform.WebOffice.WebSendMessage();                               //交互OfficeServer的OPTION="SENDMESSAGE"       
    if (webform.WebOffice.Status=="1") {
      alert("可以允许打印,注:该实例设置总文档打印份数2份");
      objPrint.Execute;
    }else{
      alert("已超出允许的打印份数");
      return false;
    }
  }
}


//作用:导入Text
function WebInportText(){
    var mText;
    webform.WebOffice.WebSetMsgByName("COMMAND","INPORTTEXT");  //设置变量COMMAND="INPORTTEXT",在WebSendMessage()时,一起提交到OfficeServer中
    if (webform.WebOffice.WebSendMessage()){                    //交互OfficeServer的OPTION="SENDMESSAGE"
      mText=webform.WebOffice.WebGetMsgByName("CONTENT");       //取得OfficeServer传递的变量CONTENT值
      webform.WebOffice.WebObject.Application.Selection.Range.Text=mText;
      alert("导入文本成功");
    }
    StatusMsg(webform.WebOffice.Status);
}


//作用:导出Text
function WebExportText(){
    var mText=webform.WebOffice.WebObject.Content.Text;
    webform.WebOffice.WebSetMsgByName("COMMAND","EXPORTTEXT");  //设置变量COMMAND="EXPORTTEXT",在WebSendMessage()时,一起提交到OfficeServer中
    webform.WebOffice.WebSetMsgByName("CONTENT",mText);         //设置变量CONTENT="mText",在WebSendMessage()时,一起提交到OfficeServer中,可用于实现全文检索功能,对WORD的TEXT内容进行检索
    if (webform.WebOffice.WebSendMessage()){                    //交互OfficeServer的OPTION="SENDMESSAGE"
      alert("导出文本成功");
    }
    StatusMsg(webform.WebOffice.Status);
}


//作用:获取文档页数
function WebDocumentPageCount(){
    if (webform.WebOffice.FileType==".doc"){
	var intPageTotal = webform.WebOffice.WebObject.Application.ActiveDocument.BuiltInDocumentProperties(14);
	alert("文档页总数:"+intPageTotal);
    }
    if (webform.WebOffice.FileType==".wps"){
	var intPageTotal = webform.WebOffice.WebObject.PagesCount();
	alert("文档页总数:"+intPageTotal);
    }
}

//作用:签章锁定文件功能
function WebSignatureAtReadonly(){
  webform.WebOffice.WebSetProtect(false,"");                  //解除文档保护
  webform.WebOffice.WebSetRevision(false,false,false,false);  //设置文档痕迹保留的状态  参数1:不显示痕迹  参数2:不保留痕迹  参数3:不打印时有痕迹  参数4:不显痕迹处理工具
  try{
    webform.WebOffice.WebOpenSignature();                     //交互OfficeServer的 A签章列表OPTION="LOADMARKLIST"    B签章调出OPTION="LOADMARKIMAGE"    C确定签章OPTION="SAVESIGNATURE"    <参考技术文档>    文档中要定义标签Manager,可以自行修改标签名称
    StatusMsg(webform.WebOffice.Status);
  }catch(e){alert(e.description);}
  webform.WebOffice.WebSetProtect(true,"");                   //锁定文档
}

//作用:客户端和服务器端信息信息交互
function WebSendInformation(){
  var info = window.prompt("请输入要传到服务器处理页面上的内容:","参数内容");
  if (info==null){return false}

  webform.WebOffice.WebSetMsgByName("COMMAND","SELFINFO");		//设置变量COMMAND="SELFINFO",用来在服务器端做判断,以进入处理自定义参数传递的代码。
  webform.WebOffice.WebSetMsgByName("TESTINFO",info);			//自定义的一个参数"TESTINFO",将info变量的信息设置到信息包中,以便传到后台。
  if (webform.WebOffice.WebSendMessage()){						//向后台发信息包。交互OfficeServer的OPTION="SENDMESSAGE"。
    info = webform.WebOffice.WebGetMsgByName("RETURNINFO");		//如果交互成功,接受服务器端返回的信息。
	alert(info);
  }
  else{
    StatusMsg(webform.WebOffice.Status);
  }
}

</script>
</head>
<body bgcolor="#ffffff" onload="Load()" onunload="UnLoad()">  <!--引导和退出iWebOffice-->
  <form name="webform" method="post" action="DocumentSave.aspx" onsubmit="return SaveDocument();">  <!--保存iWebOffice后提交表单信息-->
    <input type="hidden" name="RecordID" value="<%=mRecordID%>">
    <input type="hidden" name="Template" value="<%=mTemplate%>">
    <input type="hidden" name="FileType" value="<%=mFileType%>">
    <input type="hidden" name="EditType" value="<%=mEditType%>">
    <input type="hidden" name="HTMLPath" value="<%=mHTMLPath%>">
    <table border=0  cellspacing='0' cellpadding='0' width=100% height=100% align=center class="TBStyle">
      <tr>
        <td align="right" class="TDTitleStyle" width=64>主题</td>
        <td class="TDStyle"><input type="text" name="Subject" value="<%=mSubject%>" class="IptStyle" onblur="SetBookmarks('Caption',this.value);" style="WIDTH:50%"><span color="blue">|选择"Word公文模板",输入"主题"内容,光标移开,WORD内容自动修改</span></td>
      </tr>
      <tr>
        <td align=right class="TDTitleStyle" width=64>作者</td>
        <td class="TDStyle"><input type="text" name="Author" value="<%=mAuthor%>" class="IptStyle" ></td>
      </tr>
      <tr>
        <td align=right class="TDTitleStyle" width=64>时间</td>
        <td class="TDStyle"><input type=text name=FileDate value="<%=mFileDate%>" readonly class="IptStyle" ></td>
      </tr>
      <tr>
        <!--td align=right valign=top  class="TDTitleStyle" width=64>内容</td-->
       <td align=right valign=top  class="TDTitleStyle" width=79 hegith=90% >
	   <b>HTML按钮</b><br><font color="red"><b>功能列表</b></font>
           <input type=button class=button value="文字批注" onclick='webform.WebOffice.ShowType=1;'>
           <input type=button class=button value="手写批注" onclick='webform.WebOffice.ShowType=2;'>
           <input type=button class=button value="文档核稿" onclick='webform.WebOffice.ShowType=0;'>
           <input type=button class=button value="新建文件" onclick='webform.WebOffice.CreateFile();'>
           <input type=button class=button value="重新批注" onclick='webform.WebOffice.ReWrite();'>
           <input type=button class=button value="全屏显示" onclick='webform.WebOffice.FullSize();'>
           <input type=button class=button value="关闭工具栏" onclick="webform.WebOffice.ShowToolBar=0">
           <input type=button class=button value="打开工具栏" onclick="webform.WebOffice.ShowToolBar=1">
           <input type=button class=button value="禁止打开文件" onclick="webform.WebOffice.DisableTools('打开文件',true)">  <!--true禁止,false启用-->
           <input type=button class=button value="隐藏新建文件" onclick="webform.WebOffice.VisibleTools('新建文件',false)"> <!--true显示,false隐藏-->
           <input type=button class=button value="隐藏全屏" onclick="webform.WebOffice.VisibleTools('全屏',false)"> <!--true显示,false隐藏-->
           <input type=button class=button value="显示全屏" onclick="webform.WebOffice.VisibleTools('全屏',true)"> <!--true显示,false隐藏-->
           <input type=button class=button value="显示版本" onclick="alert('当前控件版本为:'+webform.WebOffice.VersionEx()+webform.WebOffice.Version());">

		<font color="red"><b>普通功能</b></font>
           <input type=button class=button value="显示痕迹" <%=mDisabled%> <%=mWord%> onclick="ShowRevision(true)">
           <input type=button class=button value="隐藏痕迹" <%=mDisabled%> <%=mWord%> onclick="ShowRevision(false)">
           <input type=button class=button value="获取痕迹" <%=mDisabled%> <%=mWord%> onclick="WebGetRevisions()">
           <input type=button class=button value="清除痕迹" <%=mDisabled%> <%=mWord%> onclick="webform.WebOffice.WebObject.Application.ActiveDocument.AcceptAllRevisions();">
           <input type=button class=button value="保护文档" <%=mDisabled%> onclick="WebProtect(true)">
           <input type=button class=button value="解除保护" <%=mDisabled%> onclick="WebProtect(false)">
           <input type=button class=button value="允许拷贝" <%=mDisabled%> onclick="WebEnableCopy(true)">
           <input type=button class=button value="禁止拷贝" <%=mDisabled%> onclick="WebEnableCopy(false)">
           <input type=button class=button value="页面设置" <%=mDisabled%> <%=mWord%> onclick="WebOpenPageSetup()">
           <input type=button class=button value="打印文档" <%=mDisabled%> <%=mWord%> onclick="WebOpenPrint()">
           <input type=button class=button value="插入图片" <%=mDisabled%> <%=mWord%> onclick="WebOpenPicture()">
           <input type=button class=button value="重调文档" <%=mDisabled%> <%=mWord%> onclick="LoadDocument()">
           <input type=button class=button value="刷新文档" <%=mDisabled%> <%=mWord%> onclick="WebReFresh()">
           <input type=button class=button value="打开本地文件" <%=mDisabled%> onclick="WebOpenLocal()">
           <input type=button class=button value="存为本地文件" <%=mDisabled%> onclick="WebSaveLocal()">

		<font color="red"><b>与服务器交互</b></font>
           <input type=button class=button value="签名印章" <%=mDisabled%> onclick="WebOpenSignature()">
           <input type=button class=button value="验证签章[A]" <%=mDisabled%>  onclick="WebShowSignature()">
           <input type=button class=button value="验证签章[B]" <%=mDisabled%>  onclick="WebCheckSignature()">
           <input type=button class=button value="打开标签" <%=mDisabled%>  <%=mWord%>  onclick="WebOpenBookMarks()">
           <input type=button class=button value="填充模版" <%=mDisabled%>  <%=mWord%>  onclick="LoadBookmarks()">
           <input type=button class=button value="保存版本" <%=mDisabled%>  onclick="WebSaveVersion()">
           <input type=button class=button value="打开版本" <%=mDisabled%>  onclick="WebOpenVersion()">
           <input type=button class=button value="保存当前版本" <%=mDisabled%>  onclick="WebSaveVersionByFileID()">
           <input type=button class=button value="保存定稿版本" <%=mDisabled%>  onclick="WebUpdateFile()">
           <input type=button class=button value="存为HTML" <%=mDisabled%>  onclick="WebSaveAsHtml()">
           <input type=button class=button value="存为HTML图片" <%=mDisabled%>  <%=mWord%>  onclick="WebSaveAsPage()">
           <input type=button class=button value="套用模版定稿" <%=mDisabled%>  <%=mWord%> onclick="WebInsertFile()">
           <input type=button class=button value="VBA套红定稿" <%=mDisabled%>  <%=mWord%>  onclick="WebInsertVBA();">
           <input type=button class=button value="打印控制管理" <%=mDisabled%> <%=mWord%>  onClick="WebCopysCtrlPrint()">
           <input type=button class=button value="导入数据内容" <%=mDisabled%>  <%=mWord%>  onclick="WebInportText();">
           <input type=button class=button value="导出文档内容" <%=mDisabled%>  <%=mWord%>  onclick="WebExportText();">
           <input type=button class=button value="插入远程表格" <%=mDisabled%>  <%=mWord%>  onclick="WebSetWordTable()">
           <input type=button class=button value="插入远程图片" <%=mDisabled%>  <%=mWord%>  onclick="WebInsertImage()">
           <input type=button class=button value="下载服务器文件" <%=mDisabled%> <%=mWord%> onclick="WebGetFile()">
           <input type=button class=button value="上传文件到服务器" <%=mDisabled%> <%=mWord%> onclick="WebPutFile()">
           <input type=button class=button value="打开远程文件"  <%=mDisabled%> <%=mWord%>  onclick="WebDownLoadFile()">
           <input type=button class=button value="设置本地时间"  <%=mDisabled%>  onclick="WebDateTime()">
           <input type=button class=button value="信息传递"  <%=mDisabled%>  onclick="WebSendInformation()">
                <font color="red"><b>VBA调用</b></font>
           <input type=button class=button value="取Word内容" <%=mDisabled%>  <%=mWord%>  onclick="WebGetWordContent()">
           <input type=button class=button value="写Word内容" <%=mDisabled%>  <%=mWord%>  onclick="WebSetWordContent()">
           <input type=button class=button value="WORD禁止拖动" <%=mDisabled%> <%=mWord%> onclick="webform.WebOffice.WebObject.Application.Options.AllowDragAndDrop=false;">  <!--false禁止拖动  true允许拖动-->
           <input type=button class=button value="打印黑白" <%=mDisabled%> <%=mWord%> onclick="WebWordPrintBlackAndWhile();">
           <input type=button class=button value="插入页眉" <%=mDisabled%> <%=mWord%> onclick="webform.WebOffice.WebObject.ActiveWindow.ActivePane.View.SeekView=9;">
           <input type=button class=button value="插入页码" <%=mDisabled%> <%=mWord%> onclick="webform.WebOffice.WebObject.Application.Dialogs(294).Show();">
           <input type=button class=button value="用Excel求和" <%=mDisabled%>  <%=mExcel%> onclick="WebGetExcelContent()">
           <input type=button class=button value="锁定工作表" <%=mDisabled%>   <%=mExcel%> onclick="WebSheetsLock()">
           <input type=button class=button value="EXCEL禁止拖动" <%=mDisabled%> <%=mExcel%> onclick="webform.WebOffice.WebObject.Application.CellDragAndDrop=false;">  <!--false禁止拖动  true允许拖动-->
           <input type=button class=button value="文档页数" <%=mDisabled%>  <%=mWord%>  onclick="WebDocumentPageCount()">

		<font color="red"><b>工具栏</b></font>
           <input type=button class=button value="关闭常用工具" <%=mDisabled%>  onclick="WebToolsVisible('Standard',false)">
           <input type=button class=button value="打开常用工具" <%=mDisabled%>  onclick="WebToolsVisible('Standard',true)">
           <input type=button class=button value="关闭格式工具" <%=mDisabled%>  onclick="WebToolsVisible('Formatting',false)">
           <input type=button class=button value="打开格式工具" <%=mDisabled%>  onclick="WebToolsVisible('Formatting',true)">
           <input type=button class=button value="关闭打印按钮" <%=mDisabled%>  onclick="WebToolsEnable('Standard',2521,false);">
           <input type=button class=button value="打开打印按钮" <%=mDisabled%>  onclick="WebToolsEnable('Standard',2521,true);">
           <input type=button class=button value="关闭文档" <%=mDisabled%>  onclick="webform.WebOffice.WebClose();">

                <font color="red"><b>其他调用</b></font>
           <input type=button class=button value="签章锁定文件" <%=mDisabled%>  onclick="WebSignatureAtReadonly();">
        </td>
        <td class="TDStyle" height=90%>
           <table border=0 cellspacing='0' cellpadding='0' width='100%' height='100%' >
             <tr>
                <td bgcolor=menu>
                  <!--调用iWebOffice,注意版本号,可用于升级-->
                  <script src="iWebOffice2006.js"></script>
                </td>
             </tr>
             <tr>
                <td bgcolor=menu height='20'><div id=StatusBar>状态栏</div></td>
             </tr>
           </table>
        </td>
      </tr>
    </table>
    <input type=submit value="  保存  " <%=mDisabledSave%> >
    <input type=button value="  返回  " onclick="history.back()"> 注意:只有选择《保存》后,所做的操作才有效!
  </form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -