template (Notes 4.5 and higher)
Sub Click(Source As Button)
Dim ws As New notesuiworkspace
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument, template As notesdocument
Dim rtitem As notesrichtextitem
Set db =session.currentdatabase
'Initiate a document that will temporarely serve as the template
Set template = db.createdocument
'The following Form is in fact the Rich Text template (with fonts, tables,
work arts, etc.)
template.Form = "PODTemplate"
'Create the document that will be initialized with the template
Set doc = db.createdocument
'Note that the following Form contains a editable Rich Text field named
"Body"
doc.Form = "POD2"
Set rtitem = doc.createrichtextitem("Body")
'That is where it happens: The template is pictured within the new Rich
Text field
Call template.rendertortitem(rtitem)
'The new document must be saved (well, that is the price to pay...)
Call doc.save(True,False)
'Editing the document gives the effect of composing a new document with a
great and editable Rich Text template.
Call ws.editdocument(True, doc)
'Good Luck in your projetcs!
End Sub
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
This was first published in November 2000