SourceForge.net Logo

RB Report Page

Download
Credits


Support This Project
RB ReportPage is a RealBasic class (and a couple of small support classes) to simplify generating reports. This project provides a GUI based layout method using the RealBasic IDE.

The RB ReportPage Class is useful when you want some information printed on a page and only intend to have a fixed page layout - an example would be an invoice - your details at the top, your customers details, a list of products and some general info and total at the bottom. Each invoice appears the same with some difference in data shown.

You may also have a page one and page two (with two removing the bottom info and showing more products than the first page to accommodate large purchases )

If you want a report that will continue on over any number of pages until all data is displayed then
this will not meet your needs.

To use Report Page :-

You may copy and paste the classes provided or you may make them external and add them to each project that you want to use them in.

Place a ccReportPage on your window and then place child controls onto it.
It is best that the size of the ccReportPage match what you expect to be used for printing (scaling is available but not perfect yet)
The main controls you use will be StaticText, EditField and Listboxes but you can also use Lines, Rectangles, RoundRectangles and Ovals
A custom canvas Control that you can sub-class is also supported which allows your own drawing
commands to be unique to your report including logo's etc.
A catchall of any RectControl which attempts to get the control to drawinto is in place but is of limited quality.

To print your report you call ReportPrint after you have done your pagesetup/restore and openprinterdialog
The window passed is the one containing the ReportPage
The graphics and the printeresetup relate to the output of the report
boldListBoxFirstRow allows you to show the first row of the listbox as bold - as the heading
(a heading is not drawn at this stage)
The useVectorGraphics allows you to draw the report either with vector graphics or bitmap graphics.
Vector graphics works well if you wish to scale the report to a different size than you have setup in
your project.
The drawback is if you have multiStyled text it will be messed up when scaled (this is more extreme on windows)
The more the scale the more noticeable the effect. (the editfield at the bottom of the example window will show this)
The drawback is that bitmap drawing is less than perfect (pretty close now) so far and produces a less clean output.

Notes about scaling ReportPages :-

I ended up with two different approaches to handling the printing - using bitmap drawing routines and using vector based drawing routines.
I found that with Mac OSX drawing into a 72dpi printersetup gives very ugly results, using the same to a 300 dpi printersetup led to very slow printing times. So I put in vector drawing routines to overcome this - the one drawback I found is when the page is scaled (the pixel sizes of the report class differ from the pixel sizes of the printersetup) text with multiple styles gets un-aligned, which is magnified on windows. (not tested on linux as yet)