把notes里的以OLE形式存放的对象,导出成一个文件。[1]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 gzxiaohao 的 blog

把notes里的以ole形式存放的对象,导出成一个文件。
sub click(source as button)
 on error goto isoerr
 dim w as new notesuiworkspace
 dim s as new notessession
 dim isolog as new noteslog("writeiso")
 
 dim dbcur as notesdatabase 
 dim dclcur as notesdocumentcollection
 dim doccur as notesdocument
 dim ole as notesembeddedobject
 dim att as variant
 
 dim dbnew as notesdatabase
 
 call isolog.openfilelog("d:\isolog.txt")
' isolog.overwritefile=true
 
 isolog.logaction("===========================当前时间是:"+now()+"======================================")
 set dbcur=s.currentdatabase  
 set dbnew=s.getdatabase("cn=zhbpms/o=gdtel","zhteloa\isofilemanager.nsf",false)
%rem
 dim dociso as  notesdocument
 dim docf as notesdocument 
 set dociso=dbnew.createdocument
 set docf=dbnew.getdocumentbyunid("9d7ee71d70644e7048256f3800345178")
 dociso.form="f_deptfile"
 dociso.parentdocunid="9d7ee71d70644e7048256f3800345178"
 dociso.str_type="file"
 dociso.foldername="导出操作"
 dociso.str_orgtype="org"
 dociso.docid=dociso.universalid
 dociso.delsymbol="0"
 dociso.dbpath="zhteloa/isofilemanager.nsf"
 
 if dociso.save(true,false) then
  call dociso.makeresponse(docf)
  call dociso.save(true,false)
 else
  isolog.logaction("a")
 end if
%endrem
 set dclcur=dbcur.unprocesseddocuments
 if dclcur.count>0 then 
  set doccur=dclcur.getfirstdocument
  while not doccur is nothing
'拆离旧iso的数据   
   if doccur.hasembedded then
    dim app
    dim document
    dim rtitem as notesrichtextitem
    dim embedded as notesembeddedobject
    set rtitem = doccur.getfirstitem("body")
    set embedded = rtitem.embeddedobjects(0)
    call embedded.activate(true)
    set app = embedded.object
    '处理excel
    if doccur.~$oleobjprogid(0)="excel.sheet" then
     call app.saveas("d:\"+doccur.universalid+".xls")
'     set wks=app.application.worksheets(1)
'     call wks.saveas("d:\"+doccur.universalid+".xls") 
'     app.application.activedocument.saveas("d:\\"+doccur.universalid+".xls")
    end if
    '处理ppt
    if doccur.~$oleobjprogid(0)="powerpoint.show" then
     call app.saveas("d:\"+doccur.universalid+".ppt")
    end if
    '处理word
    if doccur.~$oleobjprogid(0)="word.document" then
     call app.saveas("d:\"+doccur.universalid+".doc")
'     set document = app.application.documents(1)
'     call document.saveas("d:\\"+doccur.universalid+".doc")
    end if
   end if
'把拆离出来的数据放到新的oa库中
   dim dociso as  notesdocument
   dim rtf as notesrichtextitem
   
   dim docf as notesdocument 
   dim vworg as notesview
   dim dclsec as notesdocumentcollection
   
   set dociso=dbnew.createdocument
   set vworg=dbnew.getview("vwrootf")
   '找一级文件夹   
   if doccur.largekind(0)<>"" then
'    dim key as string
'    if doccur.largekind(0)="质量记录表格清单" or doccur.largekind(0)="质量记录表格清单" then
'     key="质量记录表样及清单"
'    else
'     key=doccur.largekind(0)
'    end if
    set docf=vworg.getdocumentbykey(doccur.largekind(0))
    if docf is nothing then
     isolog.logaction("新oa中没有“"+doccur.largekind(0)+"”这个一级分类!")
     goto nextprodoc
    end if
   end if
   '查找二级文件夹
   if doccur.secondkind(0)<>"" then
    set dclsec=docf.responses
    dim doctmp as notesdocument
    dim hassec as boolean
    
    hassec=false
    if dclsec.count>0 then

本文关键:把notes里的以OLE形式存放的对象,导出成一个文件。
  相关方案
Google
 

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

go top