AlReport
A set of components created for reports without binding to a database.
© 1999 by Thomas Kerkmann
Released to the public domain.
Version 1.2
This components are freeware. If you use them in commercial applications please ask the author.
Contact:
mailto:thkerkmann@t-online.de
Introduction
Since Version 1.1 the names of components and properties have been internationalized. But you will find the old german names in () brackets.
Version History
version 1.0 – first release to public domain Jan 1999 (german)
version 1.1 - released March 1999 (intl)
contains reptrans.exe to convert german version reports to intl.
contains alreport.doc (word97) documentation with preview-form example.
contains demoprogram
version 1.2 - released May 1999
new component tAlLabel (instead of using tAlField with no data)
tAlLabel and tAlField are able to print multiple line data.
new property Ruler on component tAlBand.
New property ClipMode on component tAlBand.
new U.S. pagesizes alr_Legal, alr_Letter
some minor internal corrections
Creating the report layout
You will start creating a report form by creating a new blank form. Then you add a tAlReport component to your form. This will adjust the height and width of your form. Then you will drop some
tAlBand (tAlAbschnitt) onto your form, and select their appropriate functions. You do this by selecting the right Bandtype (Abschnitttyp).
The tAlBand component has a property ClipMode. With this property you can manipulate how multiple line text in tAlLabel and tAlField components may be clipped.
You don’t have to include the report form into your project. Just add the dfm files to your distribution files. The report is loaded with the LoadReport (<form-file>,rep,frm) function. This function will create and read the form from the dfm file, and return with the frm and rep variables set. So you can customize the report without changeing the program itself, and you can have many layouts for the same report, by having more than one dfm file populated with the same report procedure.
Adding static text to the report
For statitc text, you drop a It is best to set the font property of the form to your default printing font. You should select a True-Type font, because it looks best in preview and printout. |
|
Adding single variable output
|
To create a report variable, you drop a |
Adding special fields
There is a component called |
|
Adding logos
The component tAlImage can contain a logo or other image to customize your report. There is no data you can add to this component. The image has to be setup at designtime.
Using shapes
|
You can use the |
Adding data
This is done with the AddNamedValue (<fieldname>,<fielddata>) method of the report component.
rep.AddNamedValue ('anyname','any-string-value‘);
You can create tables/columns by adding multiple values to the same valuename.
for i:=0 to ListBox1.Count do
rep.AddNamedValue ('LB_VALUE',ListBox1.Strings[i]);
Preview and printing
After you have filled your report with data values by using the function AddNamedValue(<name>,<valuestring>) you may print or preview the report.
with tFrmPreview.Create(Application) do
begin
rep.Preview (Previewer.FPages);
FirstPage;
end;
This will create a MDI child preview form (see Appendix: A sample preview form with the tAlPreview component), and advise the report to create the output on the previewers "Pages".You do not have to create any of theese pages yourself. This is done automatically. You then can print the report from the preview form. If you do not want a preview, just call the reports print method.
rep.Print;
If you want, you can call the PrinterSetupDialog before actually printing.
All you have to do at the end is to release the form you loaded in the beginning.
frm.Free;
Since all elements belong to the report component onto your report form, everything is cleaned up by releasing the form itself.
Master/Detail reports
Still to be written...
They are created using the tAlDetaillink component.
Appendix
A sample preview form