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:
-
- <Script language ="VBScript">
-
- Sub button1_onclick
- Dim S, Dir, DB, Doc, EO, no, word, worddoc
-
- Set S = Createobject ("Lotus. notessession")
-
- Call S. initialize
-
- Set DB = S. getdatabase ("Sh_server","Intranet \ webtemp. nsf")
-
- Set Doc = dB. getdocumentbyunid ("30c11b03d279463548256c7d000ddd74")
-
- Set eo = Doc. getattachment ("Common example .doc")
-
- Call eo. extractfile ("C: \ temp \ test.doc")
- 'Create the wordObject:
-
- Set word = Createobject ("Word. Application") 'Create wordObject
-
- Call word.doc uments. Open ("C: \ temp \ test.doc")
-
- Set worddoc = word. activedocument 'get a handleForThe active document
-
- Word. Visible = true
-
- 'Call eo. Remove
-
- 'Set ritem = Doc. getfirstitem ("Rtfattachment")
- & Apos; set no = ritem. embedobject (1454,"","C: \ temp \ test.doc")
-
- 'Call Doc. Save (true, false) Administrator
-
- Ad
-
- 'Msgbox dB. filename +"&"+ DB. server ,,"Databases on"+ DB. Server
-
- End sub
-
- </SCRIPT>
Button code on the form:
- <Input name ="Button1"Type ="Button"Value ="Edit body">
VBA code on the Word template:
- Private sub document_close ()
-
- Activedocument. Save
-
- Dim S, Dir, DB, Doc, EO, no, word, worddoc
-
- Set S = Createobject ("Lotus. notessession")
-
- Call S. initialize
-
- Set DB = S. getdatabase ("Sh_server","Intranet \ webtemp. nsf")
-
- Set Doc = dB. getdocumentbyunid ("C47e90193c0e4d3248256c780006a73e")
-
- Set eo = Doc. getattachment ("Common example .doc")
- Call eo. Remove
-
- Set ritem = Doc. getfirstitem ("Rtfattachment")
-
- Set NO = ritem. embedobject (1454,"","C: \ temp \ test.doc")
-
- Call Doc. Save (true, false)
-
- Msgbox dB. filename +"The file has been uploaded to the server! &"+ DB. server ,,"Databases on"+ DB. Server
-
- 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.