Primer - pas s spremenljivo višino
For examples in this topic create a clone of report '241 - Invoice' that is in the program menu 'Goods| Issue| Document | Document (e.g. 300 - Sale)'. You will work on this report.
Band with Stretchable Height
Let's take a look at the example of properties of "Text" object "SerialNo" (Serial number) and band "bSerialNo".
As you can see in object inspector the following values of properties are set:
For "Text" object "SerialNo":
- "AutoWidth" (let the object adjust the width according to the length of the text) to 'False'
- "StretchMode" (how the object adjusts the height according to the length of the text) to 'smActualHeight'
- "WordWrap" (toggle the text into a new line) to 'True.'
For band "bSerialNo":
- Stretched (if the height of the band should be adjusted to the height of the objects in it) to 'True'
It has also assigned "OnBeforePrint" event with the following script:
procedure bSerialNoOnBeforePrint(Sender: TfrxComponent);
begin
CallQRBeforeBandPrint(Sender, TfrxBand(sender).visible);
end;
The procedure CallQRBeforeBandPrint calls the code in program which in this case displays serial numbers belonging to the position on invoice. If there is no serial number it hides the.
Hiding Objects
Let's look at an example of hiding an object. Mark the "Image of our company" object and uncheck property "Visible" in the context menu.
Save changes and see the preview. You will notice you do not see the object in the preview - the reserved space for the object is preserved.

 |
Do not change names of objects on such reports because program code may affects value displayed on report and some important data will not be displayed. If you do not need them just hide them. |
 |
Some objects are prescribed by laws and legal acts and must not be deleted in legislation in which they are needed. |
Deleting "Text" Object Referenced by Code
Let's look an example of deleting object, which is referenced by code (but we do not know this yet). Delete thick line under text "Invoice". As it will be turned out in the next step it is named "mTitle2". Close the designer and save changes. Close also report preview. Then run the report. The next error message will appear:

Close message window and open designer. Run report from designer. You will get the next picture:

Open code editor and "comment out" line
mTitle2.Width := mTitle1.CalcWidth + fKljuc.CalcWidth - 8;
We add '//' to the beginning of this row so that it becomes
// mTitle2.Width := mTitle1.CalcWidth + fKljuc.CalcWidth - 8;
The other possibility in this case is to just hide object. It will still exists on report but will not be displayed.
 |
-
If we move an object on such a report to another band, we must also move the corresponding code there. Otherwise report may not work properly.
-
When open report design from report preview window and running report from designer results may be incorrect.
|
Hiding Bands
We can hide band by writing the line of script. To hide band "bTehPostopek", we write a line of a script marked with the bold font. We must write it as the last statement before the end; in a procedure with the same name. The italicized words must match.
procedure bTehPostopekOnBeforePrint(Sender: TfrxComponent);
begin
CallQRBeforeBandPrint(Sender, TfrxBand(sender).visible);
// bTehPostopek.visible := VarToStr(<tbIzpisPrometPoz."MSTEMPTEHPOSTOPEK">) = 'T';
bTehPostopek.visible := False; // previous line is replaced with this one
end;
Deleting Band Referenced by Code
Let's look how to delete band "DetailFooter2", on which is displayed document's note. Operation is a little bit tricky. Before start create backup copy of report and write order of bands on report. It is good practice to create printscreen of report design. In our case the previous band is "DetailFooter" and the next one is "bIzjavaTekst". Delete band "DetailFooter2".
 |
If we do not delete band but only code for visibility assigned to this band in the "OnBeforePrint" event empty space appears in the place of document's note.
|
When running the report from designer similar error appears as in the previous two cases. After deleting the script:
DetailFooter2.visible := VarToStr(<qReportIzpisD."acNote">) <> '';
report will opens but data after not will not be displayed.
.
To display data again just click on band "bNacinPlacI" and open object inspector. Set name of the band which was previously after the band which we have just deleted as property "Child". In our case it is "bIzjavaTekst".

Report will display data at the end of report again like before.
Adjusted Objects
Because of more precise aligning and faster designing the vast majority of objects on system reports are adjusted to either on the edge of the band or to other objects.
Property which specify this behavior of objects within the band is "Align". We access this property only in the object inspector which can be displayed or hidden in the “View>Toolbars...” menu command. Property values are:
Value |
Description |
baNone |
Object is not adjusted. This is the default value. |
baLeft |
Object is adjusted to the left. |
baRight |
Object is adjusted to the right. |
baWidth |
Object is adjusted to the left and right. |
baCenter |
Object is adjusted in the center. |
baBottom |
Object is adjusted to the lower side. |
baClient |
Object is adjusted across the object. |
 |
Before moving objects it is advisable to change the property "Align" to "baNone" and set it at the end of designing if you need. |
Example of Column Insertion
In the table on the report, we will replace the total discount rate with discount 1 and discount 2. In the column, where the previous value was discount, we will display a discount 1, and the on its right we will insert column discount 2. Below is a part of report with table header and document position before

and after changes.

First, we mark all objects on bands "QRBand1" and "Detail". To do this, hold down the 'Ctrl 'key, click the mouse with the "Item" and drag it to the right and the bottom. Then in object inspector set the value of property "Align" to 'baNone', so that objects will not be adjusted to others.
Move the "Text" object with text "D%" and the corresponding field with data below slightly to the left. Then copy and paste them to their right. Set "Align" property of "Text" objects "Quantity", "U/M" and both objects with the text "D % " to 'baRight' so they will be aligned to the right. The object with the text "Name" is aligned on both sides. This is done by setting "Align" property to 'baWidth'. Do the same with the data objects in the bottom row.
The copied object in the table header is displayed above the line so that it is not visible in its entirety. To fix this, click to the "SendToBack" item on the context menu. Now the line will draw over it and will be visible in its entirety.
We align the data objects horizontally. To do this, mark all objects in the Detail band and click on the button
in the alignment toolbar.
Change the text in both objects in which the text is "D %" to "D1 %" and D2' respectively.
In objects with data on the discount from the drop-down menu, select fields with anRebate1 data for discount 1 and anRebate2 for discount 2.
Explanation: For example on the picture discounts are: discount1 50 %, discount2: 20 % and superdiscount 0 %. Total discount is smaller then sum of both discounts because discounts are not adding up.