gObject.Application.UserName=webform.WebOffice.UserName;
}
}
if (webform.WebOffice.FileType==".xls"){
if (mShow){
if (mTrack){
gObject.Application.DisplayCommentIndicator = 1;
}
}else{
gObject.Application.DisplayCommentIndicator = 0;
}
gObject.CommandBars('Reviewing').Enabled =mTools;
gObject.CommandBars('Reviewing').Visible =mTools;
if (mProtect){
for (var mIndex=1;mIndex<=gObject.Application.ActiveWorkbook.Sheets.Count;mIndex++){
var mSheet=gObject.Application.ActiveWorkbook.Sheets(mIndex);
mSheet.Protect("", true, true, true);
}
}
if (gUserName == "") {
//保存原来的用户
gUserName=gObject.Application.UserName;
//设置系统当前用户
gObject.Application.UserName=webform.WebOffice.UserName;
}
}
//打开成功
gOpened = true;
}
function OnDocumentClosed()
{
//关闭成功
gOpened = false;
}
//显示系统状态信息
function StatusMsg(mString){
StatusBar.innerText=mString;
}
//页面装入事件
function Load(){
//给控件属性付值
try{
webform.WebOffice.WebUrl="<%=mServerUrl%>";
webform.WebOffice.RecordID="<%=mRecordID%>";
webform.WebOffice.Template="<%=mTemplate%>";
webform.WebOffice.FileName="<%=mFileName%>";
webform.WebOffice.FileType="<%=mFileType%>";
webform.WebOffice.EditType="<%=mEditType%>";
webform.WebOffice.UserName="<%=mUserName%>";
//打开文档,执行发送LOADFILE操作
webform.WebOffice.WebOpen();
if (webform.WebOffice.Error!=""){
//如果不成功,执行发送LOADTEMPLATE操作
webform.WebOffice.WebLoadTemplate();
if (webform.WebOffice.Error!=""){
//如果还没有成功,则根据扩展名创建新文档
if (webform.WebOffice.FileType==".doc"){
webform.WebOffice.CreateNew("Word.Document");
}else if(webform.WebOffice.FileType==".xls"){
webform.WebOffice.CreateNew("Excel.Sheet");
}else if(webform.WebOffice.FileType==".ppt"){
webform.WebOffice.CreateNew("PowerPoint.Show");
}else{
webform.WebOffice.CreateNew("");
}
}
}
}catch(e){
}
//显示状态信息
StatusMsg(webform.WebOffice.Status);
}
//页面退出事件
function UnLoad(){
try{
//关闭OCX控件
webform.WebOffice.WebClose();
}catch(e){}
}
//设置是否显示痕迹
function ShowRevision(vValue){
var object=webform.WebOffice.ActiveDocument;
object.ShowRevisions=vValue;
if (vValue){
StatusMsg("显示痕迹...");
}else{
StatusMsg("隐藏痕迹...");
}
}
//调入文档
function LoadDocument(){
StatusMsg("正在打开文档...");
webform.WebOffice.WebOpen();
StatusMsg(webform.WebOffice.Status);
}
//保存文档
function SaveDocument(){
//判断状态
if (webform.EditType.value=="0"){
alert("你在查看状态,不能保存!");
return false;
}
//保存文档
webform.WebOffice.WebSave();
//如果没有错误
if (webform.WebOffice.Error!=""){
StatusMsg(webform.WebOffice.Status);
return false;
}else{
StatusMsg(webform.WebOffice.Status);
return true;
}
}
//打开版本信息
function WebOpenVersion(){
var mDialogUrl = "Version/VersionList.asp?RecordID="+webform.WebOffice.RecordID;
var mObject = new Object();
mObject.FileID = "";
mObject.Result = false;
window.showModalDialog(mDialogUrl, mObject, "dialogHeight:280px; dialogWidth:420px;c
enter:yes;scroll:no;status:no;");
来源:upschool.cn
作者:
关键字:翻译
发表日期:2006-7-26
网页显示有限 阅读全文请下载本文完整版WORD文档
上一篇:Asp:base64编码、解码函数 下一篇:突破IIS的客户端连接限制
共13页
9 7 [
1] [
2] [
3] [
4] [
5] [
6] [
7] [
8] [
9] [
10] [
11] [
12] [
13]
8 :>
2009-1-9 1:57:28