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 skanth@parker.com

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 Doc1.save (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 Doc1.save( True,True)

Call UIDoc.Close
Set UIDoc =ws.editdocument(True, Doc1)
Call UIDoc.refresh
End Sub

This was first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.