OpenNTF.org - ReportGenerator Class
    Advanced
   OpenNTF Code Bin
Edit Document Code By Date > Code Document
About This Code
Brief Description:
ReportGenerator Class 
Rating:
Rating: 5 , Number of votes: 1 
Contributor:
Andre Guirard 
Category:
Lotusscript 
Type:
Example Code 
Document Release:
1.1 
Notes Version:
R6.x, R8.x, R7.x 
Last Modified:
14 Dec 2007 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
A class for creating rich-text reports and displaying them in a few different ways. It includes code to deal with the problem of paragraphs getting too long, and conversely, the problem of having too many paragraphs. Basically, when you want to have a line break in your report, the class only starts a new paragraph if you specify it has to. Otherwise it uses line break, unless the paragraph is getting too long, in which case it starts a new paragraph.


Or to put it more succinctly, you get the longest possible report (functionality!) with the smallest possible number of paragraphs (performance!).

Use the attached sample database, whose About document contains full instructions and which includes a sample agent that uses the class.

UPDATE: I have added functions to support the use of predefined tables in your report. The tables may be in a Page design element or anywhere else (but there's special code to support the use of pages. Since tables have a 255-row limit, we automatically insert multiple tables if you ask for more rows than that.

Usage / Example
Option Public
Option Declare
Use "Class ReportGenerator"

Sub Initialize
Dim rows%
rows = 300
Dim rgen As New ReportGenerator(DISPLAYTYPE_TAB, "", "", Nothing)
rgen.AutoDisplay = True
rgen.AddReportTitle "Table Test Report", rows & " rows"
rgen.AddTableFromPage rows+1, "Table ViewReport", "Table ViewReport2"
' we're assuming you have Page design elements with the above names, the first containing
' the 'beginning' table with the column headings, the second a 'continuation' table.
rgen.AdvanceCell 3 ' skip header row
Dim i%
For i = 1 To rows
rgen.AddText SpellOutNumber(i) ' code for this function not supplied, this is just an example of inserting values in the cells.
rgen.NextCell
rgen.AddText Cstr(i)
rgen.NextCell
Next
rgen.Display
End Sub
Code Attachments
ReporterSample.nsf (576 Kbytes)
 Comments
Posted by Grant R Lindsay on 07/02/2007 03:34:21 PMThanks
Talk about timing! This solved a problem I was having, right when I was having it.
Thanks.
-- Grant
 Add your comment!