Local editing of a domino Word Document

Source: Internet
Author: User

Steps:

1. The client registers the notes COM control. (Regsvr32 c: \ Lotus \ notes \ domobj. TLB) regsvr32 c: \ Lotus \ notes \ nlsxbe. dll

(Note: The COM component for registering Domino uses nlsxbe. dll instead of domobj. TLB. This has left me depressed for a long time .)

2. Save some custom document templates in the document database. Used to create a document.

3. Add VBScript to the form to remove the attachment from the server to the local device, and then use word. (The macro security of word is set to medium)

4. Add VBA to the exit event of the Word document in the document template.CodeTo upload files to the server. (Note: I have seen that a company's OA is automatically saved when writing is disabled .)

 

Note: To avoid the prompt password input box when starting COM, you can use API to create a DLL to avoid it. (I note: it is to use C API to perform a domino login verification filter)

 

Related code:

VBScript code on the form:

  1. <Script language ="VBScript">
  2. Sub button1_onclick
  3. Dim S, Dir, DB, Doc, EO, no, word, worddoc
  4. Set S = Createobject ("Lotus. notessession")
  5. Call S. initialize
  6. Set DB = S. getdatabase ("Sh_server","Intranet \ webtemp. nsf")
  7. Set Doc = dB. getdocumentbyunid ("30c11b03d279463548256c7d000ddd74")
  8. Set eo = Doc. getattachment ("Common example .doc")
  9. Call eo. extractfile ("C: \ temp \ test.doc")
  10. 'Create the wordObject:
  11. Set word = Createobject ("Word. Application") 'Create wordObject
  12. Call word.doc uments. Open ("C: \ temp \ test.doc")
  13. Set worddoc = word. activedocument 'get a handleForThe active document
  14. Word. Visible = true
  15. 'Call eo. Remove
  16. 'Set ritem = Doc. getfirstitem ("Rtfattachment")
  17. & Apos; set no = ritem. embedobject (1454,"","C: \ temp \ test.doc")
  18. 'Call Doc. Save (true, false) Administrator
  19. Ad
  20. 'Msgbox dB. filename +"&"+ DB. server ,,"Databases on"+ DB. Server
  21. End sub
  22. </SCRIPT>

Button code on the form:

    1. <Input name ="Button1"Type ="Button"Value ="Edit body">

VBA code on the Word template:

  1. Private sub document_close ()
  2. Activedocument. Save
  3. Dim S, Dir, DB, Doc, EO, no, word, worddoc
  4. Set S = Createobject ("Lotus. notessession")
  5. Call S. initialize
  6. Set DB = S. getdatabase ("Sh_server","Intranet \ webtemp. nsf")
  7. Set Doc = dB. getdocumentbyunid ("C47e90193c0e4d3248256c780006a73e")
  8. Set eo = Doc. getattachment ("Common example .doc")
  9. Call eo. Remove
  10. Set ritem = Doc. getfirstitem ("Rtfattachment")
  11. Set NO = ritem. embedobject (1454,"","C: \ temp \ test.doc")
  12. Call Doc. Save (true, false)
  13. Msgbox dB. filename +"The file has been uploaded to the server! &"+ DB. server ,,"Databases on"+ DB. Server
  14. End sub

The preceding step is missing. You can use js to create a file stream to download the files on the server to the client.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.