JS中使用COM访问Louts组件

从CSND上找到这么篇东东:

 

  1.  总体思路:
  2. 实现步骤:
  3. 1,客户端注册NOTES COM控件。(regsvr32 c:/lotus/notes/DOMOBJ.TLB)regsvr32  c:/lotus/notes/nlsxbe.dll
  4. 2,在公文数据库中,保存一些已经定制好的公文模板。已供新建公文时使用。
  5. 3,表单上加入VBScript将附件从服务器拆离到本地,然后起用WORD。(Word的宏安全性设为中)
  6. 4,公文模板中,WORD的文档的退出事件中加入VBA代码,实现文件上传到服务器。
  7. 注:为避免启动COM时出现提示口令输入框,可以通过API制作一个DLL来避开。(参考:API例子的)
  8. 相关代码:
  9.  表单上的VBScript代码:
  10. <SCRIPT LANGUAGE="VBScript">
  11. Sub Button1_OnClick
  12.     dim s, dir, db, doc, eo, no, word, worddoc
  13.     Set s = CreateObject("Lotus.NotesSession")
  14.     Call s.Initialize
  15.     Set db = s.GetDatabase("sh_server","intranet/webtemp.nsf")
  16.     Set doc = db.getDocumentByUNID("30C11B03D279463548256C7D000DDD74")
  17.     Set eo = doc.getAttachment("普通公文.doc")
  18.     Call eo.ExtractFile( "C:/Temp/test.doc")
  19.   'Create the Word object:
  20.   Set word = CreateObject("Word.Application") 'Create Word object
  21.   Call word.documents.open( "C:/Temp/test.doc" ) 
  22.   Set worddoc = word.activedocument 'Get a handle for the active document
  23.   word.visible = True
  24.     'Call eo.remove
  25.     'Set ritem = doc.getFirstItem("rtfAttachment")
  26.     'Set no = ritem.EmbedObject(1454, "" , "C:/Temp/test.doc" )
  27.     'Call doc.save(True,False)administrator
  28.     ad
  29.     'MsgBox db.filename + " & " + db.server,, "Databases on " + db.server
  30. End Sub
  31. </SCRIPT>
  32.  表单上的按钮代码:
  33. <INPUT NAME="Button1" TYPE="BUTTON" VALUE="编辑正文">
  34. Word模板上的VBA代码:
  35. Private Sub Document_Close()
  36.     ActiveDocument.Save
  37.     Dim s, dir, db, doc, eo, no, word, worddoc
  38.     Set s = CreateObject("Lotus.NotesSession")
  39.     Call s.Initialize
  40.     Set db = s.GetDatabase("sh_server""intranet/webtemp.nsf")
  41.     Set doc = db.GetDocumentByUNID("C47E90193C0E4D3248256C780006A73E")
  42.     Set eo = doc.GetAttachment("普通公文.doc")
  43.     Call eo.Remove
  44.     Set ritem = doc.GetFirstItem("rtfAttachment")
  45.     Set no = ritem.EmbedObject(1454, """C:/Temp/test.doc")
  46.     Call doc.Save(True, False)
  47.     MsgBox db.FileName + " 文件已上传至服务器!& " + db.Server, , "Databases on " + db.Server
  48. End Sub

其他的都实现了,就是那个“提示口令输入框”还没能实现,现在是将密码直接写在JS中,查看源代码就可以看见了,安全性太差了。考虑用cookie来实现吧,还是不安全。这个DLL到底怎么写呐

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值