Generate Fancy Reports

Dear Friends,

You have difficulty in generating reports in Notes? Here is the code that will
take off your burden.

In this code I have referred a form named "Report form", which has a rich text
field called "Report",
I have a SaveOptions field it can be of any type. The Data to generate the
report is got from "Report view"

This code is put in an action button.

If you have any questions please send me a mail at

With regards

Sub Click(Source As Button)
Dim ws As New notesuiworkspace
Dim UIDoc As NotesUiDocument
Dim session As New NotesSession
Dim db As NotesDatabase
Dim Doc As NotesDocument
Dim Doc1 As NotesDocument
Dim view As NotesView
Dim richStyle As NotesRichTextStyle

Set UIDoc = ws.currentdocument
Set db = session.CurrentDatabase
Set view = db.GetView( "Report View" ) 'View which you want to present in
the report

'i had to do this block to make it R5 compatible
Set Doc1 = UIDoc.document
Doc1.form ="Report Form"
Doc1.saveoptions ="1"
Call (True,True)
Call UIDoc.refresh
Call UIDoc.Close
Set UIDoc =ws.editdocument( True, Doc1)
Set Doc1 = UIDoc.document
Set richStyle = session.CreateRichTextStyle
Dim rtitem As Variant
Set rtitem = Doc1.GetFirstItem( "Report" ) ' Report is a rich text field

richStyle.FontSize = 9
Call rtitem.AppendStyle(richStyle)

Set Doc = View.GetFirstDocument

While Not ( doc Is Nothing )
' Use Chr(9) for Tab and Chr(10) for new line

______________________________________ "_
' Setting the font type
richStyle.Bold = True
Call rtitem.AppendStyle(richStyle)
rtitem.APPENDTEXT( "Remarks: ") ' add labels in your report

richStyle.Bold = False
Call rtitem.AppendStyle(richStyle)

Set Doc = View.GetNextDocument(doc)

' Add a line at the end of the report

______________________________________ ")

Doc1.form ="Report Form" ' name of the report form
Doc1.saveoptions ="1" 'must have a SaveOptions field on the report form
Call True,True)

Call UIDoc.Close
Set UIDoc =ws.editdocument(True, Doc1)
Call UIDoc.refresh
End Sub
This was first published in November 2000

Dig Deeper on Lotus Notes Domino Administration Tools



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...