Implement multiple page text display
Now assume that the contract form field name is "
Contract
, Page size domain name
"Pageno"
Page digital domain name
"Pages"
The contract number domain name
"ContractNO"
.
To ensure that the next page is filled in, the value of the previous page must be ""
Contract
Select in the properties of the form
"
Formula inherits the value of the selected document
"
. The most critical here is to inherit the contract number, the page number, and the number of pages. In order to get the correct value of the above information in the new page, some formulas should be added to the default value of the above domain. in
"ContractNO"
The default value in the domain is:
Contractno
. You can copy the contract number of the previous page to the new page to ensure that the same transaction is guaranteed. in
"Pageno"
The default value in the domain is:
@IF (@environment ("isnext") = "true"; @DO (@environment ";"; "); PAGENO 1); 1)
.
The above formula can identify the page that is currently the first page or continues to fill in, "
Pages "
The default value in the domain is
Pageno
.
It should be noted that although the number of pages of the new page that continues to be filled out has increased, it has not changed the number of pages on the previously fills. From a logical perspective, the number of pages that have been filled in the previous page should be added to the last page, so the number of pages cannot be unified to the new page when the new page is not saved.
When you press the "Continue to fill in the next page" button, the execution operation includes two: save and close the current page and open a new page. Here
Lotus Script
Write code, the detailed code is as follows:
Dim workspace As New NotesUIWorkspace Dim uidoc As NotesUIDocument Dim session As NotesSession Set uidoc = workspace.CurrentDocument If uidoc.editmode = True Then Call uidoc.save End If Call session.SetEnvironmentVar ( "isNext", "True") '
Set the logo for distinguishing the next page
Call Uidoc.close Call Workspace.composedocument (",", "Contract")
Here are some information (such as pages) to keep synchronization at all pages under the transaction. This needs to modify the corresponding information of other pages after saving the current page. The code for these operations can be in the contract form
POSTSAVE "
Write in the event. The specific code is as follows:
Sub Postsave (Source As Notesuidocument) Dim session As New notessession Dim db As notesdatabase Dim doccol As notesdocumentcollection Dim datetime As notesdatetime Dim doc As notesdocument Set db = session.currentdatabase formsearch $ = "form =" "Contract" "&& contractNo =" "" Source.Document.contractn o (0) "" "" SET DOCCOL = DB.Search (FormSearch $, DATETIME, 0) if Doccol.count>
0 THEN for i = 1 to doccol.count if i = 1 THEN SET DOC = DOCCOL.GETFIRSTDocument Else Set Doc = DOCCOL.GETNEXTDocument (DOC) end if if Doc.Universalid
<>
Source.Document.Universalid the doc.pages = source.document.pages (0) '
You can set other values that require fields
Call Doc.save (True, False) '
Let it unify all pages
END IF next end if End Sub
Now, multi-page documents have been established, but also browsing it. The way you browse can be "up and down" or "to the specified page", the principles are the same, here to browse the next page as an example.
First, create a button "Browse Next" and at the button
click
Write the following in the event
Lotus Script
Code:
Dim workspace As New NotesUIWorkspace Dim uidoc As NotesUIDocument Dim session As New NotesSession Dim db As NotesDatabase Dim doc As NotesDocument Dim doccol As NotesDocumentCollection Dim datetime As Notesdatetime Set uidoc = workspace.CurrentDocument Set db = session.currentdatabase SearchFormula = "Form =" "Contract "&& contractno =" " uidoc.document.contract no (0) " "&&p Ageno =" "" " cstr (uidoc.document.pageno (0) 1) " ""
Can specify any page
If uidoc.editmode = True Then Call uidoc.save End If Call uidoc.close Set doccol = db.search (SearchFormula, datetime, 0) Set doc = doccol.getfirstDocument Set uidoc = workspace.EditDocument (False, doc) so far, and more The creation and browsing of page text have been described, but considering the possibility of deleting some pages, it is also necessary for deleting the processing of the specified page. Deleting the basic process of the specified page should include deleting a document for the specified page, find all the documents of the transaction, modify the pages of these documents and the modified page domain value greater than the document page domain that deletes the page page.
The following is the process of achieving this process
Lotus Script
Function proxy:
Function deletedocument (doc As notesdocument) Dim session As New notessession Dim db As notesdatabase Dim doccol As notesdocumentcollection Dim datetime As notesdatetime Set db = session.currentdatabase contractno $ = doc.contractNo (0) pageno = doc.pageNo (0) If doc. Remove (0) THEN FORMSEARCH = "form =" "Contract" "&& contractno =" "" ContractNO $ "" "SET DOCCOL = DB.Search (FormSearch $, DATETIME, 0) for i = 1 to doccol.count IF i = 1 THEN SET DOC = DOCCOL.GETFIRSTDocument Else Set Doc = DOCCOL.GETNEXTDocument (DOC) end if Doc.pages = DOC.PAGES (0) -1 if Doc.pageno (0)
>
Pageno the doc.pageno = doc.pageno (0) -1 Endiff doc.save (true, false) Next End If End Function
Above
Lotus Notes
In the application, a processing method for multi-page text is used.