📄 documentedit.jsp
字号:
var mPassword=null;
//清除所有设置变量
webform.WebOffice.MsgTextClear();
//设置要插入的图片名称
webform.WebOffice.SetMsgByName("IMAGENAME",vImgName);
//发送到服务器上
webform.WebOffice.SendToServer("INSERTIMAGE");
//如果没有错误
if (webform.WebOffice.Error==""){
//将服务器返回的图片保存
webform.WebOffice.MsgFileSave(mFilePath+vImgName);
//如果没有错误
if (webform.WebOffice.Error==""){
//如果是word文档
if (webform.WebOffice.FileType==".doc"){
var mInlineShapes=null;
var mBookMark=FindBookmarks(vLabName);
if (mBookMark){
mInlineShares=mBookMark.InlineShapes.AddPicture(mFilePath+vImgName);
}else{
mInlineShares=webform.WebOffice.ActiveDocument.Application.Selection.InlineShapes.AddPicture(mFilePath+vImgName);
}
mImgShape=mInlineShares.ConvertToShape();
mImgShape.Select();
mImgShape.PictureFormat.TransparentBackground = vTrans;
mImgShape.PictureFormat.TransparencyColor = 16777215;
mImgShape.Fill.Visible = false;
mImgShape.WrapFormat.Type = 3;
mImgShape.ZOrder(vZOrder);
}
//如果是Excel文档
if (webform.WebOffice.FileType==".xls"){
webform.WebOffice.ActiveDocument.ActiveSheet.Pictures.Insert(mFilePath+vImgName).Select();
mImgShape =webform.WebOffice.ActiveDocument.Application.Selection.ShapeRange;
mImgShape.PictureFormat.TransparentBackground = vTrans;
mImgShape.PictureFormat.TransparencyColor = 16777215;
mImgShape.Fill.Visible = false;
mImgShape.ZOrder(vZOrder);
}
}
//清除文件
webform.WebOffice.MsgFileClear(mFilePath+vImgName);
}
StatusMsg(webform.WebOffice.Status+webform.WebOffice.Error);
}
//套用模版定稿
function InsertFile()
{
//取得目录名称
var mFilePath=webform.WebOffice.MsgFilepath;
//取得文件类型
var mFileName=webform.WebOffice.RecordID+webform.WebOffice.FileType;
var mBookRange;
//保存当前文件
webform.WebOffice.Save(mFilePath+mFileName,true);
//如果没有问题
if (webform.WebOffice.Error==""){
//清除所有设置变量
webform.WebOffice.MsgTextClear();
//设置需要调用的模版名称
webform.WebOffice.SetMsgByName("TEMPNAME","template.doc");
//发送该信息到服务器上
webform.WebOffice.SendToServer("INSERTFILE");
//如果没有错误
if (webform.WebOffice.Error==""){
//关闭当前文件
webform.WebOffice.Close();
//保存模版文件
webform.WebOffice.MsgFileSave(gFileName);
//如果没有错误
if (webform.WebOffice.Error==""){
//打开模版文件
webform.WebOffice.Open(gFileName,true);
//查找需要插入的位置(标签)
var mPosition=webform.WebOffice.GetMsgByName('POSITION');
if (mPosition.length>0){
mBookRange = FindBookmarks(mPosition);
}else{
mBookRange = webform.WebOffice.ActiveDocument.Range.Application.Selection;
}
//将原工作文档插入到该位置
mBookRange.InsertFile(mFilePath+mFileName);
}
}else{
alert(webform.WebOffice.Error);
}
}
//清楚文件
webform.WebOffice.MsgFileClear(mFilePath+mFileName);
StatusMsg(webform.WebOffice.Status)
}
//打印黑白
function WebWordPrintBlackAndWhile(){
var i,n;
//图片变黑白
i=0;
n=webform.WebOffice.ActiveDocument.Shapes.Count;
for (var i=1; i<=n; i++)
{
webform.WebOffice.ActiveDocument.Shapes.Item(i).PictureFormat.ColorType=3;
}
i=0;
n=webform.WebOffice.ActiveDocument.InlineShapes.Count;
for (var i=1; i<=n; i++)
{
webform.WebOffice.ActiveDocument.InlineShapes.Item(i).PictureFormat.ColorType=3;
}
//文字变黑白
webform.WebOffice.ActiveDocument.Application.Selection.WholeStory();
webform.WebOffice.ActiveDocument.Application.Selection.Range.Font.Color = 0;
}
//作用:统计页数
function WebDocumentPageCount(){
if (webform.WebOffice.FileType==".doc"){
var intPageTotal;
intPageTotal = webform.WebOffice.ActiveDocument.Application.ActiveDocument.BuiltInDocumentProperties(14);
alert("文档页总数:"+intPageTotal);
}
if (webform.WebOffice.FileType==".wps"){
var intPageTotal;
intPageTotal = webform.WebOffice.ActiveDocument.PagesCount();
alert("文档页总数:"+intPageTotal);
}
}
//作用:表格生成及填充
function SetWordTable(){
var mText="",mName="",iColumns,iCells,iTable;
//清除所有设置变量
webform.WebOffice.MsgTextClear();
//发送到服务器上
webform.WebOffice.SendToServer("WORDTABLE");
//如果没有错误
if (webform.WebOffice.Error==""){
//取得列
iColumns = webform.WebOffice.GetMsgByName("COLUMNS");
//取得行
iCells = webform.WebOffice.GetMsgByName("CELLS");
//生成表格
iTable=webform.WebOffice.ActiveDocument.Tables.Add(webform.WebOffice.ActiveDocument.Application.Selection.Range,iCells,iColumns);
for (var i=1; i<=iColumns; i++)
{
for (var j=1; j<=iCells; j++)
{
mName=i.toString()+j.toString();
//取得表格内容
mText=webform.WebOffice.GetMsgByName(mName);
//填充单元值
iTable.Columns(i).Cells(j).Range.Text=mText;
}
}
}
StatusMsg(webform.WebOffice.Status);
}
</script>
<script language="javascript" for=WebOffice event="OnDocumentOpened(vFileName,vObject)">
OnDocumentOpened(vFileName,vObject); //打开文件事件
</script>
<script language="javascript" for=WebOffice event="OnDocumentClosed()">
OnDocumentClosed(); //关闭文件事件
</script>
</head>
<body bgcolor="#ffffff" onload="Load()" onunload="UnLoad()">
<form name="webform" method="post" action="DocumentSave.jsp" onsubmit="return SaveDocument();">
<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);" ></td>
</tr>
<tr>
<td align=right class="TDTitleStyle" width=64>作者</td>
<td class="TDStyle" ><input type=text name=Author value="<%=mAuthor%>" class="IptStyle" onblur="SetBookmarks('Author',this.value);" ></td>
</tr>
<tr>
<td align=right class="TDTitleStyle" width=64>时间</td>
<td class="TDStyle"><input type=text name=FileDate value="<%=mFileDate%>" class="IptStyle" readonly onblur="SetBookmarks('Time',this.value);" ></td>
</tr>
<tr>
<td align=right class="TDTitleStyle" width=64><font color="red"><B>功能列表</b></font></td>
<td colspan="5" class="TDStyle" bgColor="#e0e3ea" >
<input type=button value="关闭菜单" <%=mDisabled%> onclick="MenuBar(false)">
<input type=button value="关闭工具栏" <%=mDisabled%> onclick="ToolBars(false)">
<input type=button value="关闭常用工具" <%=mDisabled%> onclick="ToolsVisible('Standard',false)">
<input type=button value="关闭格式工具" <%=mDisabled%> onclick="ToolsVisible('Formatting',false)">
<input type=button value="关闭审阅按钮" <%=mDisabled%> onclick="ToolsVisible('Reviewing',false)">
<input type=button value="关闭打印按钮" <%=mDisabled%> onclick="ToolsEnable('Standard',2521,false);">
<BR>
<input type=button value="显示菜单" <%=mDisabled%> onclick="MenuBar(true)">
<input type=button value="显示工具栏" <%=mDisabled%> onclick="ToolBars(true)">
<input type=button value="打开常用工具" <%=mDisabled%> onclick="ToolsVisible('Standard',true)">
<input type=button value="打开格式工具" <%=mDisabled%> onclick="ToolsVisible('Formatting',true)">
<input type=button value="打开审阅按钮" <%=mDisabled%> onclick="ToolsVisible('Reviewing',true)">
<input type=button value="打开打印按钮" <%=mDisabled%> onclick="ToolsEnable('Standard',2521,true);">
<a href="http://www.dragongod.com/share/isignature.rar" target="_blank">iSignature电子签章系统,请下载后安装!</a>
</td>
</tr>
<tr bgcolor="#e0e3ea">
<!--td align=right valign=top class="TDTitleStyle" width=64>内容</td-->
<td align=right valign=top class="TDTitleStyle" width=64 hegith=90% >
<br>主要功能<br>
<input type=button class=button value="隐藏痕迹" <%=mDisabled%> <%=mWord%> onclick="ShowRevision(false)">
<input type=button class=button value="显示痕迹" <%=mDisabled%> <%=mWord%> onclick="ShowRevision(true)">
<input type=button class=button value="清除痕迹" <%=mDisabled%> <%=mWord%> onclick="webform.WebOffice.ActiveDocument.AcceptAllRevisions();">
<input type=button class=button value="保护文档" <%=mDisabled%> onclick="Protect(true)">
<input type=button class=button value="解除保护" <%=mDisabled%> onclick="Protect(false)">
<input type=button class=button value="页面设置" <%=mDisabled%> onclick="OpenPageSetup()">
<input type=button class=button value="打印文档" <%=mDisabled%> onclick="OpenPrint()">
<input type=button class=button value="插入图片" <%=mDisabled%> onclick="OpenPicture()">
<font color="red"><B>版本控制</b></font>
<input type=button class=button value="保存版本" <%=mDisabled%> onclick="SaveVersion()">
<input type=button class=button value="打开版本" <%=mDisabled%> onclick="OpenVersion()">
<font color="red"><B>服务交互</b></font>
<input type=button class=button value="手写签名" <%=mDisabled%> onclick="OpenHandWrite()">
<input type=button class=button value="签名印章" <%=mDisabled%> onclick="OpenSignature()">
<input type=button class=button value="验证签章" <%=mDisabled%> onclick="ShowSignature()">
<input type=button class=button value="远程图片" <%=mDisabled%> onclick="InsertImage('Image','样品.jpg',true,4);">
<input type=button class=button value="填充模版" <%=mDisabled%> <%=mWord%> onclick="LoadBookmarks()">
<input type=button class=button value="标签传值" <%=mDisabled%> <%=mWord%> onclick="OpenBookMarkList()">
<input type=button class=button value="表格填充" <%=mDisabled%> <%=mWord%> onclick="SetWordTable()">
<font color="red"><B>数据管理</b></font>
<input type=button class=button name="BookMark" value="标签管理" onclick="GetModel()">
<input type=button class=button name="Template" value="模板管理" onclick="GetModel()">
<input type=button class=button name="Signature" value="印章管理" onclick="GetModel()">
<font color="red"><B>VBA调用</b></font>
<input type=button class=button value="取Word内容" <%=mDisabled%> <%=mWord%> onclick="GetWordContent()">
<input type=button class=button value="写Word内容" <%=mDisabled%> <%=mWord%> onclick="SetWordContent()">
<input type=button class=button value="用Excel求和" <%=mDisabled%> <%=mExcel%> onclick="GetExcelContent()">
<input type=button class=button value="Excel保护工作表" <%=mDisabled%> <%=mExcel%> onclick="SheetsLock()">
<font color="red"><B>其他调用</b></font>
<input type=button class=button value="VBA套红定稿" <%=mDisabled%> <%=mWord%> onclick="InsertVBA();">
<input type=button class=button value="套用模版定稿" <%=mDisabled%> <%=mWord%> onclick="InsertFile()">
<input type=button class=button value="保存定稿文件" <%=mDisabled%> <%=mWord%> onclick="UpdateFile()">
<input type=button class=button value="导入Text" <%=mDisabled%> <%=mWord%> onclick="InportText();">
<input type=button class=button value="导出Text" <%=mDisabled%> <%=mWord%> onclick="ExportText();">
<input type=button class=button value="插入字符"
<%=mDisabled%> <%=mWord%> onclick="webform.WebOffice.ActiveDocument.Application.Dialogs(162).Show();">
<input type=button class=button value="WORD禁止拖动" <%=mDisabled%> <%=mWord%> onclick="webform.WebOffice.ActiveDocument.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.ActiveDocument.ActiveWindow.ActivePane.View.SeekView=9;">
<input type=button class=button value="插入页码" <%=mDisabled%> <%=mWord%> onclick="webform.WebOffice.ActiveDocument.Application.Dialogs(294).Show();">
<input type=button class=button value="EXCEL禁止拖动" <%=mDisabled%> <%=mExcel%> onclick="webform.WebOffice.ActiveDocument.Application.CellDragAndDrop=false;"> <!--false禁止拖动 true允许拖动-->
<input type=button class=button value="文档页数" <%=mDisabled%> <%=mWord%> onclick="WebDocumentPageCount()">
<input type=button value="插入Text" class=button onclick="IText();" <%=mDisabled%> <%=mWord%>>
</td>
<td class="TDStyle" height=90% >
<table border=0 cellspacing='0' cellpadding='0' width='100%' height='100%' >
<tr>
<td bgcolor=menu >
<OBJECT id="WebOffice" width="100%" height="100%" classid="clsid:33739A7E-2004-4D1C-88D5-D50B18F7C347" codebase="<%=mClientUrl%>">
<param name="BorderStyle" value="1">
<param name="Menubar" value="1">
<param name="Toolbars" value="1">
<param name="Caption" value="2004052401">
<param name="WebUrl" value="<%=mServerUrl%>">
<param name="RecordID" value="<%=mRecordID%>">
<param name="Template" value="<%=mTemplate%>">
<param name="FileName" value="<%=mFileName%>">
<param name="FileType" value="<%=mFileType%>">
<param name="EditType" value="<%=mEditType%>">
<param name="UserName" value="<%=mUserName%>">
</OBJECT>
<OBJECT id="WebHandWrite" width="100%" height="10" classid="clsid:4F5880F1-39BB-415E-BC85-3AD756D438AB">
<param name="UserColor" value="#0f0f00">
<param name="PenWidth" value="3">
<param name="ZOrder" value="4">
</OBJECT>
</td>
</tr>
<tr>
<td bgcolor=menu height='20'>
<div id=StatusBar>状态栏</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<input type=submit value=" 保 存 " <%=mDisabled%> >
<input type=button value=" 返 回 " onclick="history.back()"> 注意:只有选择《保存》后,所做的操作才有效!
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -