ReportBuilder 15 and Delphi XE4: Report Objects
ReportBuilder 15 and Delphi XE4: Report Objects
I am using ReportBuilder 15 into Delphi XE4. ReportBuilder is a reporting tool which is used to print reports in Delphi applications. I just came across various Report Objects like TppDBText, TppDBImage, TppDBBarCode, TppDBCalc, TppDetailBand, TppFooterBand, TppHeaderBand, TppGroup, TppImage, TppLabel, TppLine, TppMemo, TppRegion, TppShape, TppSubReport, TppTitleBand, TppSummaryBand and TppSystemVariable. Lets try to understand all these Report Objects of ReportBuilder 15.
1. TppDBText
The TppDBText component is a data-aware report control that is used to print text from a database field. The database field that is printed is the value of the DataField property.
To avoid printing the same data on consecutive detail lines set the SuppressRepeatedValues property to true. When SuppressRepeatedValues is set to True you can enable the field value to reprint on the first detail line of a new page by setting the ReprintOnSubsequent property to True.
Use the DisplayFormat property to control how the text is formatted.
How the text of the caption aligns within the label is determined by the value of the Alignment property.
You can have the control resize automatically to fit a changing caption if you set the AutoSize property to True.
Set the WordWrap property to True if you the want the text to wrap rather than be truncated to fit inside the control.
2. TppDBImage
The TppDBImage component is a data-aware report control that is used to print a graphical image stored in a database field, such as a BLOB field. The image that is printed is determined by the value of the DataField property.
Set the Stretch property to True if you want to scale the picture to fit inside the report control.
3. TppDBBarCode
Use this object to print bar codes on your report for numeric data. All data fields will use the TppDBText object.
4. TppDBCalc
Used for simple database calculations (Sum, Min, Max, Count and Average). The value can be reset when a group breaks using the ResetGroup property.
The TppDBCalc component is a data-aware report component used to perform common report calculations and print the resulting value. The calculation is performed based on the value of the field specified in DataField Use the DBCalcType property to indicate the necessary calculation.
Calculations such as group totals are available through ResetGroup property. Each time the field value for the Reset Group changes (breaks), all associated DBCalc components are reset to zero.
Use the DisplayFormat property to control how the text is formatted.
Text alignment of the caption is determined by the value of the Alignment property. You can force the control to resize to fit a changing caption by setting the AutoSize property to True.
You can control the appearance of this component (Font, Alignment, etc.) at design-time by using the Format Bar of the Report Designer. The Format Bar also allows you to set the DataField property from a drop down list box at the far left. You can also set key properties by using the speed menu. To access the speed menu, position the mouse cursor over the component and click the right mouse button.
5. TppDetailBand
The detail band prints multiple times on the page until all page space is utilized or an ending condition is detected. The Detail Band is used for printing multiple records.
This object is created automatically along with the TppHeaderBand and the TppFooterBand.
NOTE: TppSubReports may be placed ONLY in a Detail Band.
6. TppFooterBand
The Footer Band will print at the bottom of each page.
This object is created automatically along with the TppDetailBand and the TppHeaderBand.
NOTE: If you need the last page of a report to contain additional information, create a TppSummaryBand.
7. TppHeaderBand
The Header Band will print at the top of each page. This object is created automatically along with the TppDetailBand and the TppFooterBand.
8. TppGroup
Use this feature to section your report. Each group can start on its own page and you can force group items to stay together.
9. TppImage
Use this object to put a picture on the report format. This is what you would use if you want to print a logo or something similar that wouldn't change.The image that is printed is determined by the value of the Picture Property.
Set the AutoSize property to True if you want the report control to resize to accommodate the size of the picture.
Set the Stretch property to True if you want to scale the picture to fit inside the component.
10. TppLabel
Use this object to put text directly into the report. Whatever you put into the Caption property will print on the report. If you want to put data from your program into the report you would use the TppDBText or TppDBBarCode object instead.
The TppLabel component is a report control that displays text on a report. Report labels are typically used for report titles, column headings, group headings, etc. The text of a label is the value of its Caption property.
How the text of the caption aligns within the label is determined by the value of the Alignment property.
You can have the label resize automatically to fit a changing caption if you set the AutoSize property to True.
Set the WordWrap property to True if you the want the text to wrap rather than be truncated to fit inside the control.
You can control the appearance of this component (Font, Alignment, etc.) at design-time by using the Format Bar of the Report Designer. The Format Bar also allows you to set the Caption property from an edit box at the far left. You can also set key properties by using the speed menu. To access the speed menu, position the mouse cursor over the component and click the right mouse button.
11. TppLine
Use TppLine to print vertical or horizontal lines. The orientation of the line is determined by the value of the Position property.
Use the Style property to control whether a single or double line is printed.
The Pen property is used to control the line's color and width.
Set the StretchWithBand property to True if you want the Height of the line to stretch as the band stretches (this only occurs when a memo component is stretching and the band PrintHeight property has been set to phDynamic).
The TppLine component is very useful for giving reports a distinctive, professional look. Double Style lines are great for underscoring report totals.
Use the Report Designer's Format Bar to set the Position property and to BringToFront or SendToBack.
Use the Graphics Palette to set the Pen Color (PC) and Pen.Width. To access the speed menu for this component, position your mouse cursor over the component and click the right mouse button.
Use this object to draw a line on the report. This would generally be used to put lines above totals, between values, etc.
12. TppMemo
Use this object to put a large amount of text directly into the report. Whatever you put into the Lines property will print on the report. If you want to put data from your program into the report you would use the TppDBText or TppDBBarCode object instead.
The TppMemo component is a report control that prints multiple lines of text on a report. The text of a memo is the value of its Lines property.
How the lines of text align within the memo is determined by the value of the Alignment property.
The amount of space between the lines within the memo is determined by the value of the Leading property.
You can enable the height of the memo to stretch automatically by setting Stretch to True and the parent Band PrintHeight property to phDynamic.
At design-time you can use the Report Designer's Format Bar to control the appearance of the report memo. Use the Object Inspector to set the value of the Lines property. Press the right mouse button to access a speed menu and set other key properties for this control.
13. TppRegion
Use the Region object to control whether items print or not and to give objects below the ability to move up if the region doesn't print. Generally you will put one or more TppDBText or TppLabel objects within a Region. Then, if you turn the Region off, none of the items within the region will print.
14. TppShape
Use this object to draw a shape on the report. This could be used to draw boxes around fields, etc.
15. TppSubReport
Use the SubReport object to create compound reports. By placing one or more SubReports in a Detail Band (on any page), the program will look for a buffer that uses the same RB_NUM as the Tag property for that SubReport. Any records waiting (they are created with the Output_Report_Data and Update_Report_Data commands) will be printed. The Detail Band can contain a combination of text (TppLabel), objects (such as TppDBText) and SubReports.
16. TppTitleBand
This object is created automatically for all SubReports that you add to your Report Form. The Title Band prints just once, when the SubReport starts. Don't forget, the Header Band created on the main page will still print on every page.
17. TppSummaryBand
This object is created automatically for all SubReports that you add to your Report Form. The Summary Band prints just once, at the end of the SubReport. Don't forget, the Footer Band created on the main page will still print on every page.
18. TppSystemVariable
This is a specialized object that you can use to put date, time or page numbers on your report.