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 tAlLabel component onto one band, and set the caption property. You can choose the font, alignment, etc and the text will be printed accordingly.

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 tAlField (tAlFeld) component onto one band, and set the name property. This name is the name you will use with the AddNamedValue procedure. As soon as you add more than one value to this name, the band will be printed for each value you assigned, eventhough other variables on the band only may contain just one value. You can set the caption property to any text you like to get an impression on how the filled report field will look like later in your report. I sometimes use 9999.99 to setup the width for a numerical filled field, or XXXXXXXXXX for a textfield of the appropriate size. This will help you to customize the column width of tables or printing width of single report fields.

 

Adding special fields

There is a component called tAlSysField (tAlSysFeld). This component is able to print some predefined values. E.g. the page number, date, time etc.

 

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 tAlShape component to create shapes of different types. See the shape property. I often use this component to create horizontal lines. Select a shape type of stRectangle, the set the height property to 1. This will give a perfect horizontal line. For the thickness of the line set the pen property.

 

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