iWebOffice2004调用VBA脚本解释及翻译[6]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 csdnhome 的 blog

        var mvalidstring=webform.weboffice.activedocument.shapes.item(mindex).alternativetext;
        if ((mvalidstring!=null)&&(mvalidstring.length!=0)){
            if ((mvalidstring.indexof("dbstep_2004")!=-1) && (mvalidstring.indexof(webform.weboffice.recordid)!=-1)){
  signaturestring=signaturestring+"\r\n"+mvalidstring.substring(12,mvalidstring.length);
     }
        }
      }
    }
    //如果是excel文件
    if (webform.weboffice.filetype==".xls"){
      for (var msheet=1;msheet<=webform.weboffice.activedocument.application.sheets.count;msheet++){
        webform.weboffice.activedocument.application.sheets(msheet).select();
        for (var mindex=1;mindex<=webform.weboffice.activedocument.activesheet.shapes.count;mindex++){
   var mvalidstring=webform.weboffice.activedocument.activesheet.shapes.item(mindex).alternativetext;
          if ((mvalidstring!=null)&&(mvalidstring.length!=0)){
              if ((mvalidstring.indexof("dbstep_2004")!=-1) && (mvalidstring.indexof(webform.weboffice.recordid)!=-1)){
    signaturestring=signaturestring+"\r\n"+mvalidstring.substring(12,mvalidstring.length);
       }
          }
        }
      }
    }

    if (signaturestring){
       alert("印章列表如下:"+signaturestring);
    }else{
       alert("没有找到任何有效印章");
    }
  }catch(e){}
}


//是否显示工具栏
function webtoolbars(visible){
  try{
     webform.weboffice.toolbars=visible;
  }catch(e){}
}
//是否显示菜单栏
function webmenubar(visible){
  try{
     webform.weboffice.menubar=visible;
  }catch(e){}
}

//是否显示某种工具栏
function webtoolsvisible(toolname,visible){
  try{
    webform.weboffice.activedocument.commandbars(toolname).visible = visible;
  }catch(e){}
}

//是否允许某工具栏上的某工具有效
function webtoolsenable(toolname,toolindex,enable){
 var i;
 try{
    for (i=1;i<=webform.weboffice.activedocument.commandbars(toolname).controls.count;i++){
 if  (webform.weboffice.activedocument.commandbars(toolname).controls(i).id==toolindex){
      webform.weboffice.activedocument.commandbars(toolname).controls(i).enabled = enable;
  break;
 }
    }
 }catch(e){}
}

//设置是否保护
function webprotect(value){
  try{
    if (value){
 if (webform.weboffice.filetype==".doc"){ 
       webform.weboffice.activedocument.protect(2);
 }else if(webform.weboffice.filetype=='.xls'){
            for (var mindex=1;mindex<=webform.weboffice.activedocument.application.activeworkbook.sheets.count;mindex++){
                var msheet=webform.weboffice.activedocument.application.activeworkbook.sheets(mindex);
                msheet.protect("", true, true, true);
            }
 }
    }else{
 if (webform.weboffice.filetype==".doc"){ 
  webform.weboffice.activedocument.unprotect();
 }else if(webform.weboffice.filetype=='.xls'){
            for (var mindex=1;mindex<=webform.weboffice.activedocument.application.activeworkbook.sheets.count;mindex++){
                var msheet=webform.weboffice.activedocument.application.activeworkbook.sheets(mindex);
                msheet.unprotect("");
            }
 }

    }
  }catch(e){}
}

//取得word内容
function webgetwordcontent(){
  try{

本文关键:Office VBA 痕迹保留 手写签名 电子印章
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top