NOTES and OFFICE interface

zhaozj2021-02-17  67

NOTES and OFFICE interface

This article NOTES AND OFFICE interface describes the preparation of the three interface programs of Notes and Office, which enables NOTES data into Office programs, and implements a more difficult label print, table print, and revision display in Notes. The MCD function of the Word "Mail" function Word can combine the data of the data from the main document, primarily to generate a document with a fixed format such as labels and envelopes. We can use this feature to extract data in the Notes database, generate documents in a fixed format, such as: Book's small label, envelope printing, etc. Proceed as follows:

Establish a data source document template (Source.dot) and main document template required for email merge. In the Notes database, a view, a form is created, saving source.dot, main.dot is attached to the form, and the post-supplied program calls this template to generate a document. Bring a Word document with Notes documentation with the Script programming. Below is the main part of the source program, the program Click the "Print" button in Notes, or when selecting "Print" in the action menu: 1 Start Word. SET WordApp = getObject ("Word.Application.8") IF iSempty (WordApp) THEN SET WORDAPP = CREATEOBJECT ("Word.Application.8") IF ISEMPTY (WORDAP) THEN MESSAGEBOX "Please install word 97 first first , 0 64, "Print" EXIT SUB End If End IF

2 Generate a data source file.

Call wordapp.documents.add Set WordSourceDoc = wordapp.activedocument Set selection = wordapp.selection Call WordSourceDoc.Tables.Add (wordapp.selection.Range, 2, 25) Call selection.TypeText ( "Book Name") Call Selection.MoveRight ( 12) Call Selection.Typetext (Book Number) Call Selection.Moveright (12) Call Selection.Typetext ("Purchase Date" Call Selection.Moveright (12) ............... File: // Generate Data Source Table Head set curdoc = uidoc.document call selection.typetext (curdoc.title (0)) Call Selection.Moveright (12) call selection.typetext (curdoc.code (0)) Call Selection.Moveright (12) call selection.typetext Curdoc.date (0)) Call Selection.Moveright (12) ............. file: // Fill in the Notes document in the data source table FileName $ = "C: / Book Data Source .DOC" Call WordsourceDoc .Saveas ("C: / Book Data Source .doc") file: // Save Data Source File

3 Generate an email merge master document.

Set view = curdb.getview ("Book Print Configuration) Set Tspzdoc = View.getDocumentByKey (curdoc.p_type (0), true) if tslxpzdoc is nothing thenmessagebox Can't find the configuration document, please regenerate" Key "editing configuration document . ", 0 64," Detection Configuration Document "EXIT SUB End If Set Ts_Label = Tspzdoc.gettachment (" Book Tag. DOT ") If FileName $ = = = "C: / Book Tag. DOT" Call Ts_Label.extractfile (filename $) Wordapp.Documents.Open ("C: / Book Tag. DOT") 4 Execute Mail Merge.

WITH WORDAPP.ActiveDocument. Mailmerge .destination = 0 .execute end with call wordapp.documents. Close (0, 0, false) Call Wordapp.Documents ("Book Data Source .doc"). Close (0, 0, false)

Using the Word Form Implementation Interface Table often usage in daily office, printing forms with Notes forms or views, not only simple, and it is difficult enough to meet the needs. At this point, you can lead the Notes database document and use the Word to generate a table. Proceed as follows:

Establish a table document template, such as: Scientific and Technology Archives Currency Call. DOT. In the Notes database, a view, a form, a list of rows, printing lines, and columns of each page, also include an RTF domain, introducing the document template into this RTF domain, generating a document. Script programming implements a Word document with Notes documentation. The following is the main part of the source program, which is executed when you click the "Print" button in Notes, or when selecting "Print" in the operation menu. 1 Get print settings and print templates.

Set doc = docs.Getfirstdocument If doc Is Nothing Then Msgbox "is not selected to print a document", Mb_Ok Mb_IconStop, "stop" Exit Sub End IfSet Worddoc = ExtractWord ( "science and technology archives files directory.") If Worddoc Is Nothing Then Exit Subfile: // Num_Beginh = worddoc .num_beginh (0) Num_beginl = worddoc.num_beginl (0) Num_HS = WordDoc.num_HS (0) file: // Get the print settings, start row, start column, each page prints

2 Start Word, generate a Word document according to the table template provided by Notes documentation.

Set Tempdoc = CreateObject ( "Word.Document.8") Set Wordapp = Tempdoc.ApplicationSet WordBasic = Wordapp.WordBasicWordBasic.FileNew Worddoc.Txt_PathName (0) ③ introducing the contents of Notes database generated Word document, to generate a table of fixed format .

Items = Worddoc.Txt_Items Pageno = 1 Row = 1 While Not (doc Is Nothing) If Row = 1 Then If Pageno = 1 Then Set Table = Wordapp.ActiveDocument.Tables (1) WordBasic.EditSelectAll Wordbasic.Editcopy Table. Cell (Num_BeginH , Num_BeginL) .Select Elsewordapp.Selection.MoveRight 1,2 Wordbasic.InsertPagebreak WordBasic.EditPasteSet WordSelection = Wordapp.Selection WordSelection.Delete 1,1 Set Table = Wordapp.ActiveDocument.Tables (pageno) Table.Cell (Num_BeginH, Num_BeginL). SELECT END IF ELSE END (ITEMS) Wordbasic.Insert Cstr (Itemstr (0)) endbasic.insert cstr (Itemstr (0)) end if if i = ubound (items) AND row = Num_HS THEN Else Wordbasic.nextCell End if Next Row = ROW 1 if Row> Num_HS TEN ROW = 1 Pageno = Pageno 1 End if Wend Wordbasic.AppShow Wordapp.WindowState = 1END SUB

Implementing the Word "Revision" feature Implementing the retained trace retention feature In the public document subsystem required for office automation, the issuance process will inevitably involve the revision of the body. According to the requirements of the file, the modified original must be retained, which requires the revision of the text of the text to be retained. It is very difficult to do this in Notes. In Word contains a revision feature, Microsoft Word will mark amendment using the revision tag if the revision is enabled. After the document is reviewed, the modifications made by different reviewers can be separated according to different text colors. Proceed as follows:

1. Create a Word document, including the following macros in the document.

1 View traces.

Sub View Traces () with activeDocument .trackrevision = false file: // Markup modified to specified documents .printRevisions = true file: // Print amendment tag while printing a document. ShouwRevisions = true file: // Display pair on the screen Specify the revision of the document end wirth sub 2 does not look at traces.

Sub Do not view traces () with activedocument .trackrevision = false .printrevision = false .showrevisions = false end wirth

3 Save exit.

SUB Save Exit () ActiveDocument.save ActiveDocument.closend Sub

2. Create the document as an object in the form, pay attention to display it as a chart form.

3. Transfer the username in Notes into Word to generate a label. The program can trigger in the Postopen event of the database, the main procedure is as follows.

Dim Wordapp As Variant Set Wordapp = CreateObject ( "Word.Document.8") If Wordapp.Application.UserName <> Session.CommonUserName ThenWordapp.Application.UserName = Session.CommonUserNamefile: // Set Word user name End IfEnd Function

转载请注明原文地址:https://www.9cbs.com/read-30769.html

New Post(0)