User Tools

Site Tools




22.11.0 Component gb.report2

The report component gb.report2 offers the option of structurally arranging and printing data from different sources. You can define the layout of a report in the IDE with the Report Designer.

Please note! The graphical report designer is not a WYSIWYG editor. The individual report controls such as Report.Label or Report.Image - within a report section - can be inserted into report containers such as Report.HBox or Report.Panel. However, the properties of the report controls that are then defined are only partially displayed. You can check the selected layout and design at any time using a report preview and a control printout in order to make corrections. It can be helpful to set the Report.Debug property to True, as the boundaries of all objects contained in the report are drawn in this mode.

As an alternative to using the Report Designer, you can also define the complete layout and design of a report via the source code. However, this always harbours the risk of entering incorrect values for selected properties or not adhering to the specified syntax, which cannot happen in the Report Designer. The Report Designer can be used if the layout is extensive with many containers and many report control elements. For example, to define a border around a ReportPanel1 (left, right, top and bottom 5 mm, top left and bottom right corners additionally rounded with a radius of 5 mm) with a linear black-red-yellow colour gradient (linear gradient), you need this value assignment of the ReportPanel1.Border property in the source code:

ReportPanel.Border = ReportBorder["Top:5mm LinearGradient(0,0.04,0,1,[#000000,#FFFF00,#FF0000],[0,1,0.5]);
Bottom:5mm LinearGradient(0,0.04,0,1,[#000000,#FFFF00,#FF0000],[0,1,0.5]);
Left:5mm LinearGradient(0,0.04,0,1,[#000000,#FFFF00,#FF0000],[0,1,0.5]);
Right:5mm LinearGradient(0,0.04,0,1,[#000000,#FFFF00,#FF0000],[0,1,0.5]);

The component reimplements the Align, Arrange and Line classes and implements a number of report classes:

Report, ReportBorder, ReportBoxShadow, ReportBrush, ReportContainer, ReportControl, ReportDrawingArea, 
ReportFrame, ReportHBox, ReportImage, ReportLabel, ReportLine, ReportMargin, ReportPadding, ReportPageBreak, 
ReportPanel, ReportSection, ReportSizeHints, ReportSizeParser, ReportSvgImage, ReportTextLabel, 
ReportVBox, ReportView, ReportVPanel, TSizeParse.

A description of the properties for the Align, Arrange and Line classes can be found under[]=align#klasse_align[]=align#klasse_arrange Class Report

The most important class of the gb.report2 component is Report, because this class represents a report.

The class behaves like a read-only array and returns a virtual object of the ReportSection data type for the specified index:

Dim hReport As Report
Dim hReportSection As ReportSection
hReportSection = hReport [ Index As Integer ] Properties of the Report class

Please note that many properties are defined via other classes such as ReportPadding, ReportBrush or ReportBoxShadow. For example, the `Report.Border` property is of the ReportBorder type. This means that these properties apply specifically to the report and are not necessarily comparable with the same properties of other control elements.

The Report class has the following properties:

PropertyData typeDescription
BackGroundReportBrushReturns or sets the background colour used by the report.
BorderReportBorderReturns or sets the border of the report.
BoxShadowReportBoxShadowReturns or sets the shadow used by the report.
BrushReportBrushReturns or sets the brush used for drawing. The default brush has a monochrome, opaque black colour.
ChildrenReportControl[]Returns a collection of all control elements contained in the container.
CountIntegerReturns or sets the number of sections in the report.
DataCountIntegerSupplies or sets the number of repetitions required to read all data.
DataIndexIntegerReturns the value of the repeat counter.
DebugBooleanFor the value True, the reports are generated in debug mode. This mode draws the boundaries of all objects contained in the report. The default is False. The value can also be read out.
Expand BooleanDelivers or sets whether a control expands if it is contained in a container. The default is True.
FixedBooleanReturns or sets whether a control is displayed each time its parent element is called. For the value False, the report control is only displayed once.
FontFontSupplies or sets the font used to draw text in the control. To change the font control at runtime, you can do the following: Use the font property of another existing control or create a font object from a string that describes the font and assign it to the report control. You can find more information at
ForceNewPageBooleanFor the value True, a new page is inserted into the report.
HeightString !Returns or sets the height used by the report. The height is of data type float. Permissible units are: mm, cm, in, ft, px, pt and specifications in %. Example: Height = “1.3cm”.
WidthString !Delivers or sets the width of the report.
IDIntegerDelivers the handle of the report.
NameStringSets the name of the report.
OnePieceBooleanThis property causes the content of the container to be printed on the same page for the value True.
OrientationIntegerDelivers or sets the orientation of the layout of the report. The value of this property is either Printer.Landscape or Printer.Portrait.
PaddingReportPaddingDelivers or sets the distance that separates a subordinate report control from the edge of the container. This applies to a report control as well as to text. Example: Report1.Padding = ReportPadding[“Top:14mm;Bottom:10mm;Left:10mm;Right:14mm”]
PageCountIntegerDelivers the current number of pages in the report.
PaperIntegerReturns or sets the paper format used for printing. Paper.Custom is returned if the Printer.PaperWidth or Printer.PaperHeight properties have been defined by the user. Example: Report1.Paper = Printer.A5. Default is A4.
ReportReportDelivers the report for a report control.
ResolutionIntegerDelivers or sets the report resolution in DPI (Dots Per Inches). If the value is zero, the value of the device is used.
ScaleFloatChanges the drawing scale. It assumes a value between 0 and 1. You can also read out the value.
SpacingStringSupplies or sets the spacing that separates the report controls in a report container. Permitted units are: mm, cm, in, ft, px, pt and specifications in %. Example: Report1.HBox1.Spacing = “5mm”
TagVariantSupplies or sets the control tag. This property is intended for the programmer and is not used by the component. Tag can be any value of the data type Variant.
TextStringDetermines the title of a section of a report.
VisibleBooleanDetermines whether the report is visible or not.

Table : Properties of the Report class

The Paper property can have one of the following values

  • Printer.A4 210 × 297 mm, 8.26 × 11.69 inches (default).
  • Printer.A3 297 × 420 mm.
  • Printer.A5 148 × 210 mm.
  • Printer.B5 182 × 257 mm, 7.17 × 10.13 inches.
  • Printer.Letter 216 × 279 mm, 8.5 × 11 inches.
  • Printer.Executive 191 × 254 mm, 7.5 × 10 inches.
  • Printer.Legal 16 × 356 mm, 8.5 × 14 inches.
  • Printer.PaperWidth Custom value
  • Printer.PaperHeight User-defined value Methods of the Report class

The Report class has these methods:

MethodReturn typeDescription
Clear ( )-Removes all report controls from the current report.
Clone ( )ReportA new instance of the current report is returned.
Layout ( )-Forces the layout or repeats the layout calculations for the current report.
Paint ( Page As Integer )-Draws the specified report page. Note that the first page is 1 and not 0.
Preview ( )-Opens a preview window with the current report. You can then print the report on a printer or print it to a PDF file, the path of which you can freely select in the dialogue.
Print ( [ hPrinter As Printer ] )-Prints the report. If the printer is specified (optional), the report is printed immediately on the specified printer. Otherwise, a dialogue opens because Printer.Configure() is called internally if at least one printer exists as the default printer in the system.

Table : Methods of the Report class

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k22/k22.11/start.txt · Last modified: 16.05.2024 by emma

Page Tools