FRNetUserManual en
FRNetUserManual en
NET User
Manual
Version 2022.1
© 2008-2022 Fast Reports Inc.
www.fast-report.com 1 / 451
Fundamentals
In this chapter we will learn the principles of working with a report in the FastReport. We will also take a close look
at report elements such as report pages, bands, and report objects.
www.fast-report.com 2 / 451
The report
The report building process can be represented as follows:
Report template (later-Report) - this is, what we see in the designer. Reports are saved in files with an extension
.FRX. A Report can be created with the help of designer or programmatically.
Data can be any: this is data, defined in the program, or data from DBMS, for example, MS SQL. FastReport can also
work with business-logic objects (later - business-objects).
Prepared Report - this is what we see in the preview window. Prepared report can be previewed, printed, saved in
one of the supported formats (.doc, .xls, .pdf and others), or can be sent by email.
www.fast-report.com 3 / 451
Report designer
In order to create a report template, a report designer is used. A designer gives the user comfortable facilities for
designing the report and allows previewing the report at the same time.
The report designer is the compound part of FastReport and does not depend on the development environment
(for example, MS Visual Studio). If you are a software developer, you may include the report designer into your
application. This will give your end-users the ability to either change the existing report or create a new one.
www.fast-report.com 4 / 451
Report options
A window with report options can be called in the "Report|Options..." menu. You will see a dialogue window with
several tabs:
On the "General" tab, you can control the following report parameters:
"Double pass" parameter allows to enable two report passes. This can be necessary when you use the "total
number of pages" system variable;
"Compress report file" parameter allows saving a report in a compressed form. For compressing, zip
algorithm is used, that is why you can easily extract original contents with the help of any archive;
"Use file cache" parameter allows to save the memory when creating a report. Use this parameter if your
report has got a lot of pages;
"Convert null values" controls converting the null value data column into the default value (0,empty string,
false - depending on the data type of a column);
"Text quality" parameter allows choosing the mode of text displaying in the report. This mode does not affect
printing of the report;
"Smooth graphics" parameter allows to enable the smooth mode when drawing graphical objects (line,
border, picture).
On the "Description" tab, you can give the description of the report. All these parameters are not obligatory, and
they serve for informational purposes:
www.fast-report.com 5 / 451
On the "Script" tab, you can choose the script language for the report. Detailed work with script can be found in the
"Script" chapter.
On the "Security" tab you can give the password which will be requested when opening the report. A report which
has a password, is saved in an encoded form, so do not forget your password! Restoring a report in this case will
be practically impossible.
On the "Inheritance" tab, you can control report inheritance. This functionality will be looked at later.
www.fast-report.com 6 / 451
Report pages
Template consists of one (mostly) or several report pages. Report page, in turn, contains bands. Report objects like
Text, Picture and others are placed on the band:
Report template can consist of several pages. For example, you can create a template containing title-page and a
page with data. When creating such a report, the first page will be printed first, then the second page and so on.
Every page of template can generate one or several pages of a prepared report – this depends on the data it
contains:
Report pages are also used when working with subreports. Contrary to other report generators, subreports in
FastReport are saved in a separate template page, and not in a separate file.
Apart from report pages, a template can contain one or more dialogue forms. Dialogue forms can be used for
inquiring some parameters before creating a report. Detailed work with dialogue forms will be covered in the
"Dialogue forms" chapter.
www.fast-report.com 7 / 451
Managing pages
When you have created a new report, it already contains one page with several bands. For adding a new page, click
the button. A page can also be added by clicking the button and choosing "New Report Page" in the
window.
In a similar way, dialogue forms can be added into the report. For this, use the button.
Template pages are displayed in the designer as tabs:
The first tab is the report code. It can neither be moved nor deleted.
In order to switch to the needed page, simply click on its tab. Changing order of the pages can be done with the
help of the mouse. For this, left click on the tab and, without leaving the mouse, move the tab to the desired place.
For deleting a page, click the button. This button is not active if the report consists of only one page.
www.fast-report.com 8 / 451
Page properties
Every report page can have its own settings, such as paper size, orientation (landscape or portrait), margins,
columns, paper source and others. Report template can contain several pages with different orientations and paper
sizes. The window with page setup can be called by clicking the button or by choosing the "File|Page setup..."
menu item.
The "Paper" group allows to set the paper size and orientation. It is possible to choose one of the supported sizes,
by using the drop-down list. It contains all paper sizes which are supported by the current printer.
The "Margins" group allows to setup page margins. The "Mirror margins on even pages" options can be used to
print booklets:
The "Source" group allows choosing the source of the paper. Note that the sources can be given separately, that of
the first page of the prepared report, and that of the rest of pages:
www.fast-report.com 9 / 451
The source can be chosen in the "Print" dialog as well.
The "Columns" group allows setup the column parameters for multi-columned report. For this, the number of
columns need to be indicated and (optional) correct the width of the column and the position of every column:
The "Other" group allows giving certain helpful page properties. It is possible to indicate duplex mode for duplex
printing if your printer supports this mode. Here it is also possible to set the watermark, which will be printed on
prepared report pages:
The "Extra design width" checkbox allows to increase the page width in the design mode. It may be useful if you
work with such objects as "Table" or "Matrix".
www.fast-report.com 10 / 451
Bands
The band is an object which is located directly on the report page and is a container for other objects like "Text",
"Picture" and others.
In all, in FastReport there are 13 types of bands. Depending on its type, the band is printed in a certain place in the
report.
Report It is printed once at the very beginning of the report. You can choose the order of printing - before the "Page
Title Header" band or after it - with the help of the "TitleBeforeHeader" page property. Changing this property can
be done with the help of "Properties" window. By default, property is equal to true, that is, report title is
printed before page header.
Report It is printed once at the end of the report, after the last data row, but before the "Page Footer" band.
Summary
Column This band is used when printing a multi-columned report (when the number of columns indicated in the page
Header setup > 1). It is printed on top of every column after the Page Header band.
Column Printed at the bottom of every column, before the Page Footer band.
Footer
Data This band is connected to the data source and is printed as many times as there are rows in the source.
Data This band is connected to the "Data" band and is printed before the first data row.
Header
Data This band is connected to the "Data" band and is printed after the last data row.
Footer
Group It is printed at the beginning of every group, when the value of the group condition changes.
Header
Child This band can be connected to any band, including another child band. It is printed immediately after its
parent.
www.fast-report.com 11 / 451
Bands in designer
A band in the designer appears in form of a rectangular area. A band, like many other report objects, can have a
border and fill (by default they are disabled). Apart from this, a band displays a grid. To set the grid mode, go the
"View|Options..." menu and choose "Report page". Grid can also be enabled or disabled in the "View" menu.
You can set the band's height in three ways:
place the mouse pointer at the bottom of the band. The cursor shape will be changed to "horizontal splitter"
and you can resize a band.
drag the band handle on the left ruler.
use "Properties" window to set the band's Height property.
The designer has two modes of displaying bands, between which you can switch at any time. In the first mode,
every band has got a header, which contains the title of the band and useful information about it (for example, the
name of the data source to which it is connected).
In the second mode, the band does not have a header. Instead of that, on the left side of the window, the structure
of the bands is displayed. This mode helps to easily understand the structure of the report, especially if it was not
created by you.
www.fast-report.com 12 / 451
Configuring bands
You can configure the bands in the "Configure Bands" window. It can be called from the "Report|Configure Bands..."
menu or with the help of the "Configure bands" button, placed over the bands tree:
In this window, it is possible to add bands into the report, delete them or change their order. To add a band, click
the "Add" button or right click on band tree. A context menu will come up containing a list of bands. A band which
cannot be added is dimmed.
The "Add" operation depends on what band was chosen in the band tree. For example, adding "Data Header" and
"Data Footer" bands is possible only if the "Data" band was selected beforehand.
There is also another way of configuring some bands. This can be done from the "Report" menu:
www.fast-report.com 13 / 451
To delete a band, select it and press "Delete" key.
When configuring bands, FastReport does not allow to do operations which leads to the creation of a wrong
report template. For example, you cannot delete the "Data" band, which is connected to the group - for this, the
group needs to be deleted first. Another example, when deleting the "Data" band, its header and footer are
deleted automatically. Also, it is not possible to delete a band if it is the only one on the page.
www.fast-report.com 14 / 451
Printing Bands
So, there are several bands placed on the page. How will FastReport compose a prepared report? Let us look at the
following example:
The "Report Title" band will be printed first. The "Page Header" band will be printed immediately after it. Further,
the "Data" band will be printed as many times as there are rows in the data source, to which the band is connected.
After all the rows of the "Data" band have been printed, the "Report Summary" band is printed and at the bottom
of the page - the "Page Footer" band. Printing of the report ends with this. A prepared report will be looking
something like this:
In the process of printing, FastReport checks if there is enough space on the current page of the prepared report, so
that the band can be printed. If there isn’t enough space, the following occurs:
page footer is printed;
a new page is added;
page header is printed;
continues to print the band which did not fit on the previous page.
www.fast-report.com 15 / 451
Band properties
Every band has several useful properties, which affect the printing process. They can be configured by using the
band’s context menu.To do this, right-click on an empty space on the band, not occupied by other objects. Also, it is
possible by clicking on the band header (if the classic display mode is used) or on band structure (otherwise).
Another method – choose a band and change the corresponding properties in the "Properties" window.
Property Description
CanGrow, CanShrink These properties determine whether a band can grow or shrink depending on the size of the
objects contained in the band. If both properties are disabled, the band will always have the size
specified in the designer. Read more about this in the "Report Creation" chapter.
CanBreak If the property is enabled, FastReport tries to print a part of the band’s contents on the available
space, that is, "break" the band. Read more about this in the "Report Creation" chapter.
StartNewPage Printing a band with such property begins on a new page. This property is usually used when
printing groups; that is, every group is printed on a new page.
PrintOnBottom A band with this property is printed at the bottom of the page, before the "Page Footer" band
.This can be useful when printing certain documents, where the total sum is supposed to be
printed at the bottom of the page.
RepeatOnEveryPage The bands - "Data Header", "Data Footer", "Group Header" and "Group Footer" - have got this
property. This type of band will be printed on each new page, when data printing is being done.
Read more about this in the "Report Creation" chapter.
www.fast-report.com 16 / 451
Report objects fundamentals
A wide range of objects can be used in the report:
"Line" (LineObject) Shows a line. The line can be vertical, horizontal, or diagonal.
"Checkbox" (CheckBoxObject) Shows a checkbox that can have two states - "on" or "off".
Gauge objects (LinearGauge, SimpleGauge, Several objects with similar functionality are designed to
RadialGauge, SimpleProgressGauge) visualize a value.
Digital Signature (DigitalSignatureObject) Shows a visible field that can be used for electronic signatures.
Objects can be used both to display information (the "Text" object) and to design a report (the "Picture", "Line",
www.fast-report.com 17 / 451
"Shape" objects). Complex objects such as "Table" and "Matrix" can contain other simple objects.
www.fast-report.com 18 / 451
Common object properties
All report objects are inherited from one basic class (ReportComponentBase) and have got certain set of common
properties. Before studying each object, we will look at these properties.
You can change the value of properties with the help of the "Properties" window. Some properties can be changed
using the object's context menu or toolbars (for example, border and fill).
Property Description
Left, Top, A report object, as a rule, is a rectangle. It has coordinates (properties Left, Top) and size (properties
Width, Height Width, Height).
Anchor This property determines how the object will be changing its position and/or its size when the container
on which it is laying grows or shrinks. By using Anchor, it can be done in such a way that, the object
expands or moves synchronously with container. Read more about this property in the "Dynamic
layout" chapter.
Dock This property determines on which side of the container the object will be docked. Read more about this
property in the "Dynamic layout" chapter.
Border, Fill These properties control the object's border and fill. They can be changed using the "Border and Fill"
toolbar.
CanGrow, These properties allow fitting the height of the object in such a way that it fits the whole text. Read more
CanShrink about this property in the "Dynamic layout" chapter.
ShiftMode An object, whose property is enabled, will be moving up and down, if the object above on can either
grow or shrink. Read more about this property in the "Dynamic layout" chapter.
GrowToBottom An object, whose property is enabled, will be stretched to the bottom of a band. Read more about this
property in the "Dynamic layout" chapter.
CanBreak Objects "Text" and "Rich Text" have this property. It determines whether the object’s contents can be
broken into parts.
PrintOn This property determines on which pages the object can be printed. Read more about this property in
the "Booklet-type report" chapter.
Cursor This property determines the type of mouse cursor when it is located over an object. The property
works only in the preview window.
Visible This property determines whether the object will be displayed in the report. Invisible object is never
displayed in the preview window and is never printed on the printer as well.
Printable This property determines whether the object will be printed on the printer. If this property is disabled,
then the object will be visible in the preview window but it will not be printed.
Hyperlink This property makes it possible to make the report object interactive. Read more about this property in
the "Interactive reports" chapter.
www.fast-report.com 19 / 451
Property Description
Bookmark This property is used together with the "Hyperlink" property. It can contain any expression. The
expression will be calculated when the report will be working, and its value will be used as bookmark's
name.
Restrictions This property restricts certain operations, such as moving, resizing, deleting the object.
Style You can assign the style name to this property. When this is done, the object will become like it has
been indicated in the style. If the parameters of the style changes, the appearance of the object changes
as well.
www.fast-report.com 20 / 451
The "Text" object
The "Text" object is the main object which you will use often. It looks like this:
www.fast-report.com 21 / 451
Text editing
In order to edit an object's text, just double click on it. You will see a text editor:
There is a data tree on the right side of the editor, which elements can be added into the text. This can be done by
dragging the element onto needed place by using the mouse. Another way to insert an element into the text -
double click on the element, and it will be added onto the cursor's current position.
In order to save the changes and close the editor window, click the OK button or press the Ctrl+Enter keys.
Another method of editing a text - in-place editing. To do this, select the "Text" object and press Enter. To finish
editing, click somewhere outside the objects bounds or press Ctrl+Enter. Press Esc key to cancel the changes.
When editing an object in-place, its size can be changed by using a mouse.
www.fast-report.com 22 / 451
Displaying the expressions
The "Text" object can contain a plain text mixed with expressions. For example:
Today is [Date]
When printing such an object, all expressions contained in the text will be calculated. So the result may look like
this:
Today is 12.09.2010
As seen, expressions are identified by square brackets. This is set in the "Brackets" property, which by default
contains the string "[,]".When needed, you can use a different set of symbols, for example "<,>", or "<!,!>". In the
last case, an expression in the text will be like this:
Today is <!Date!>
Apart from this, it is possible to disable all expressions. To do this, set the AllowExpressions property to false. In this
case the text will be shown "as is".
Inside the square brackets, you can use any valid expression. Read more about expressions in the "Expressions"
chapter. For example, an object with the following text:
2 * 2 = [2 * 2]
2 * 2 = 4
Frequent mistake - attempt to write an expression outside the square brackets. Reminding, that it is considered an
expression and gets executed only that, which is located inside square brackets. For example:
2 * 2 = [2] * [2]
2 * 2 = 2 * 2
There may be elements inside an expression that needs own square brackets. For example, it may be a reference to
a system variable (see the "Expressions" chapter for details). Let's look at the following example:
www.fast-report.com 23 / 451
The next page: [[Page] + 1]
The text contains an expression [Page] + 1. Page is a system variable which returns the number of the current
report page. It is included in own brackets. These brackets must be square brackets, regardless of the "Text" object
settings.
Strict speaking, we were supposed to use two pairs of square brackets when using the "Date" system variable in the
examples above:
Today is [[Date]]
However FastReport allows to leave out unnecessary pair of brackets if there is only one member in an expression.
www.fast-report.com 24 / 451
Displaying the data columns
You can print the data column in the following way:
As you can see, the square brackets are used here. The data source name and data column name are separated by
the period. For example:
[Employees.FirstName]
Read more about using the data columns in the "Expressions" chapter.
There are several ways to insert a data column into the "Text" object.
1. In the "Text" object's editor we write the name of the data column manually. This method is the most
inconvenient as it is easy to make a mistake.
2. In the object's editor we choose the needed data column and drag&drop it into the text:
3. Click on the small button in the upper right corner of the object and choose the data column from a list:
4. Drag&drop a data column from the "Data" window into the report page. In this case the "Text" object is
created which contains a link to the column.
www.fast-report.com 25 / 451
HTML tags
You may use some simple HTML tags in the "Text" object. By default, tags are disabled; to enable it, go "Properties"
window and set the "HtmlTags" property to true. Here is a list of supported tags:
Tag Description
<sub>...</sub> Subscript.
<sup>...</sup> Superscript.
<font color=...>... Font color. The color may be either the named color (such as DarkGray), or a hexadecimal code in the
</font> #RGB format, for example #FF8030.
www.fast-report.com 26 / 451
Object's properties
Property Description
AllowExpressions This property allows to turn on or off the expression handling. It is on by default.
AutoShrink This property allows to shrink the font size or font width automatically to fit the text.
AutoShrinkMinSize This property determines the minimum size of a font, or the minimum font width ratio, if the
AutoShrink property is used.
BreakTo With this property you can organize the text flow from one text object to another. For example, we
have "A" and "B" text objects. The "A" object contains the long text that does not fit in the object's
bounds. You can set the A.BreakTo to B, so the "B" object will display the part of text that does not
fit in "A".
Clip This property determines whether it is necessary to clip a text outside of object's bounds. It is on by
default.
Duplicates This property determines how the repeated values will be printed. Read more about this property in
the "Formatting" chapter.
FirstTabOffset This property determines the offset of the first TAB symbol, in pixels.
FontWidthRatio Use this property to make the font wider or narrower. By default the property is set to 1. To make
the font wider, set the property to value > 1. To make the font narrower, set the property to value
between 0 and 1.
HideValue This property is of string type. It allows to hide values that are equal to the value of this property.
Read more about this property in the "Formatting" chapter.
HideZeros This property allows to hide zero values. Read more about this property in the "Formatting" chapter.
Highlight This property allows to setup the conditional highlight. Read more about this in the "Formatting"
chapter.
HtmlTags Allows simple HTML tags in the object's text. Read more about this property in the "HTML tags"
chapter.
LineHeight This property allows to explicitly set the height of a text line. By default it is set to 0, so the default
line spacing is used.
www.fast-report.com 27 / 451
Property Description
NullValue The text that will be printed instead of a null value. You also need to uncheck the "Convert null
values" option in the "Report/Options..." menu.
RightToLeft This property indicates whether the text should be displayed in right-to-left order.
TabWidth This property determines the width of the TAB symbol, in pixels.
TextFill This property determines the text fill. Use this property editor to choose between different fill types.
Trimming This property determines how to trim the text that does not fit inside the object's bounds. It is used
only if the "WordWrap" property is set to false.
Underlines This property allows to display a graphical line after each text line. This property can be used only if
the text is top-aligned.
Wysiwyg This property changes the display mode of the "Text" object to match the screen and the final
printout. This mode is also used if you use the justify-align or non-standard line height.
www.fast-report.com 28 / 451
The "Rich Text" object
This object displays the formatted text (in the RTF format). It looks like this:
Try to use the "Text" object to display a text. When you export the report to some document formats, the "Rich
Text" object will be exported as a picture.
This object supports only the solid fill type. Gradient, hatch, glass fills are not supported.
To edit the object, double click on it. You will see the editor window:
You can also use the Microsoft Word to create a text. When you have done, save the text in the .RTF format. Next,
you need to open the "Rich Text" editor and load the .RTF file into it by pressing the button.
The "Rich Text" object does not support all of the Microsoft Word formatting features.
www.fast-report.com 29 / 451
Property Description
AllowExpressions This property allows to turn on or off the expression handling. It is on by default.
www.fast-report.com 30 / 451
The "Picture" object
An object can display graphics in the following formats: BMP, PNG, JPG, GIF, TIFF, ICO, EMF, WMF. With the help of
the "Picture" object, you can print your company logo, a photo of employee or any graphical information. The
object looks like this:
Source Description
File Picture is loaded from a file and is saved inside the report. Picture is stored in the "Image" property.
with a
picture
Data Picture from a data column. Name of the column is stored in the "DataColumn" property.
column
File Picture is loaded from a file with the given name. Name of file is stored in the "ImageLocation" property. Picture
name is never stored inside the report. You should distribute the picture file along with the report.
URL Picture is loaded from the internet every time the report is created. Image is never stored inside the report. URL
is stored the in the "ImageLocation" property.
In order to call a picture editor, double click on the object. In the editor, you can choose the data source for the
picture:
In order to bind the object to a data column, click on the small button in the upper right corner of the object and
choose the data column from a list:
www.fast-report.com 31 / 451
You also can drag&drop a data column from the "Data" window into the report page. In this case the "Picture"
object is created which contains a link to the column. The column you drag should have the "byte[]" data type.
In the context menu of the "Picture" object you can choose the size mode:
AutoSize. The object gets the size of the picture.
CenterImage. The picture is centered inside the object.
Normal. The picture is displayed in the left corner of the object.
StretchImage. The picture is stretched to the size of the object.
Zoom. The picture is stretched to the size of the object in accordance with the aspect ratio.
The difference between modes is shown in the following picture:
Property Description
Angle The rotation angle, in degrees. Possible values for this property are 0, 90, 180, 270.
Transparency The degree of transparency of the pictures. The property can have values between 0 and 1. The value
0 (by default) means that the picture is opaque.
TransparentColor The color which will be transparent when displaying the picture.
ImageLocation This property can contain name of the file or URL. The picture will be loaded from this location when
building the report.
www.fast-report.com 32 / 451
Property Description
ShowErrorImage Shows the "No picture" picture, in case when the picture is empty. This property makes sense to use if
the picture is downloaded from the Internet.
www.fast-report.com 33 / 451
SVG object
This object is used for displaying vector images in SVG format. An example of such an image:
To add an SVG image, add an SVG object to your report using the following button in the object panel:
After that click on the object twice, or select "Edit" in the context menu. This will open the Image Editor, which is
similar to the Image Object Editor.
In this editor you can set the image that will be shown by the object. You can include an image in the report
template (the "Open" button on the "Image" tab), select an SVG image from the data table (the "Data Field" tab),
establish a connection to an external SVG file (the "File name" tab, in this case you need to distribute this file
together with the template) or set a hyperlink from the address from which the image will be obtained (the
"Hyperlink" tab).
If you include an image in the report template, its string representation will be stored in the SVGString property.
The screenshot shows a fragment of such a line:
www.fast-report.com 34 / 451
The SVG object supports the same sizing modes as the Picture object: AutoSize, CenterImage, Normal,
StretchImage, Zoom.
A detailed description of these modes is given in the description of the Picture object.
www.fast-report.com 35 / 451
The "Line" object
The "Line" object can display horizontal, vertical or diagonal line. The object is as follows:
If possible, use the object's border instead of "Line" object. This will simplify the report and avoid possible
problems with the export to different formats.
FastReport designer has convenient tools for drawing a line. In order to insert a line into a report, click the
button on the "Objects" toolbar and in the menu choose the "Line" object or "Diagonal Line". Place the mouse
cursor at the location where the line will start from. Then left click and hold the mouse, in order to draw the line.
After this, you can draw the line again. When all the lines have been drawn, click on the button on the "Objects"
toolbar.
An ordinary line differs from a diagonal line in that you can make it only vertical or horizontal.
Do not choose the "Double" line style for this object. This style applies only to the object's border.
Property Description
Diagonal The property determines weather the line is diagonal. An ordinary line can be turned into a diagonal one
by enabling this property.
StartCap, These properties allow to setup the line caps. You can use one of the following cap styles:
EndCap - ellipse
- rectangle
- diamond
- arrow
Size of the cap can be set in the Width, Height properties of the cap. You can configure caps for each end
of the line.
www.fast-report.com 36 / 451
The "Shape" object
The "Shape" object displays one of the following shapes:
rectangle;
rounded rectangle;
ellipse;
triangle;
diamond.
The object is as follows:
In order to insert a shape into the report, click the button on the "Objects" toolbar and choose the needed
shape type.
The shape, like any other report object, has a fill and border. Contrary to the "Text" object, you cannot control each
border line. Also, don't use the "Double" line style.
Property Description
Curve This property is used with the "RoundRectangle" shape. It allows to set the curve.
www.fast-report.com 37 / 451
Polyline and polygon objects
These objects are used to display a variety of shapes such as polygons. They are in the same category as the Shape
and Line objects. To place the Polygon object, open the menu under the and select one of the polygons. You
can place a pre-made five-, six-, seven- or octagon. Alternatively, you can select Polygon to draw the shape yourself.
An example of what a polygon might look like:
The gray lines in the image help you see how the object will look after adding a new point.
After placing the first point, you can add additional ones. After you finish drawing the polygon, press Escape or
switch Edit mode. The editing mode panel for the Polyline and Polygon objects is located on the Home tab.
Polyline and polygon editing modes:
Adding This mode turns on immediately after adding a polygon. To add a point, select this mode and select
a point one of the points of the object. After that, hover over the desired location of the point and press the
left mouse button. The point will be added next to the one you selected.
Moving In this mode, you can move the entire object, as well as stretch it.
and
scaling
Deleting To remove a point from a polygon or polyline, select this mode and click on the desired point. You
a point can also select it in another mode and press the Delete key.
Mouse This mode allows you to view and move all points of the object that were added earlier.
pointer
Curve In this mode, you can add a point of a curve to the line adjacent to the selected point. This line will
anchor become a Bezier curve, and the added point will act as an anchor.
point
www.fast-report.com 38 / 451
This is what a broken line with a set point of curvature (blue) looks like. The red line shows the state of the line
before it was converted to a curve.
Both objects have the ability to adjust their borders, and the Polygon object supports the same fill modes as the
rest of the objects.
www.fast-report.com 39 / 451
The "Barcode" object
The object displays barcodes in the report. It looks like this:
2 of 5 Interleaved 0-9
2 of 5 Industrial 0-9
2 of 5 Matrix 0-9
EAN8 8 0-9
EAN13 13 0-9
MSI 0-9
PostNet 0-9
UPC A 12 0-9
UPC E0 6 0-9
UPC E1 6 0-9
www.fast-report.com 40 / 451
Code Length Allowed symbols
PDF417 any
Datamatrix any
QR Code any
Aztec any
Pharmacode 0-9
GS1-128 0-9,A-Z
A detailed description of different barcode types can be found in the internet, for example, here:
http://www.barcodeisland.com
Barcode data in an object is of a string type. The string can contain any symbol, allowed for the chosen type of
barcode. You can choose the type of barcode in the context menu of the "Barcode" object.
You can connect an object to data by using one of the following methods:
set the barcode data in the "Text" property;
bind the object to a data column using the "DataColumn" property;
set the expression that returns the barcode data in the "Expression" property.
The "Barcode" object has the following properties:
Property Description
Barcode This property contains barcode-specific settings. Expand this property to set these settings.
Angle This property determines the rotation of a barcode, in degrees. You can use one of the following values: 0,
90, 180, 270.
Zoom This property allows to zoom a barcode. It is used along with the "AutoSize" property.
AutoSize If this property is on, the object will stretch in order to display a whole barcode. If this property is off, the
barcode will stretch to to object's bounds.
ShowText This property determines whether it is necessary to show the human-readable text.
www.fast-report.com 41 / 451
Property Description
The following properties are specific to the barcode type. To change them, select the barcode, go "Properties"
window and expand the "Barcode" property.
Property Description
WideBarRatio This property is specific to all linear barcodes. It determines the wide-to-narrow bar ratio. For most of
barcode types, the value for this property should be between 2 and 3.
CalcCheckSum This property is specific to all linear barcodes. It determines whether is necessary to calculate the
check sum automatically. If this property is off, you should provide the check digit in the barcode
data.
AutoEncode This property is specific to the Code128 barcode. This code has three different encodings - A, B, C.
You should either set the encoding explicitly in the barcode data, or set this property to true. In this
case the encoding will be chosen automatically.
If you set the "AutoEncode" property to true, all control codes will be ignored. Example of use the
control codes:
&C;1234&B;ABC
AspectRatio This property is specific to the PDF417 barcode. It determines the height-to-width aspect ratio and is
used to calculate the barcode size automatically (in case the "Columns" and "Rows" properties are not
set).
CodePage This property is specific to the PDF417 and Datamatrix barcode. It determines the code page which is
used to convert non-ASCII chars. For example, the default windows codepage is 1251.
Columns, Rows These properties are specific to the PDF417 barcode. They determine the number of columns and
rows in a barcode. If both properties are set to 0, the size of the barcode will be calculated
automatically. In this case the "AspectRatio" property is used as well.
CompactionMode This property is specific to the PDF417 barcode. It determines the PDF417 data compaction mode.
ErrorCorrection This property is specific to the PDF417 barcode. It determines the error correction level.
PixelSize This property is specific to the PDF417 barcode. It determines the size of barcode element, in screen
pixels. As a rule, the element's height should be greater than the element width by 3 times or more.
Encoding This property is specific to the Datamatrix barcode. It determines the Datamatrix data encoding.
www.fast-report.com 42 / 451
Property Description
PixelSize This property is specific to the Datamatrix barcode. It determines the size of barcode element, in
pixels.
SymbolSize This property is specific to the Datamatrix barcode. It determines the size of barcode symbol.
www.fast-report.com 43 / 451
QR codes
QR code is a two-dimensional barcode used to store numeric, alphanumeric, and binary information.
For correct recognition of a QR code using a camera, it uses special markers at the corners and the area of the
image.
This allows you to normalize the image after reading and convert the dot coding to binary numbers with checksum
verification.
A QR code can contain up to 4296 characters (alphanumeric encoding is used).
Object
To add a QR code to the report page, click on Barcode in the tool palette.
Then you need to select QR Code in the list and click on the report page.
Double click on the barcode image to open a special editor. This can also be done from the context menu by
choosing the Edit item.
www.fast-report.com 44 / 451
Editor
The QR code editor looks like a regular expression editor. There is a tree of data, parameters and functions on the
right. From there, you can drag items into the text editor.
The main difference from the expression editor is the drop-down menu that defines the content type of the QR
code.
www.fast-report.com 45 / 451
Depending on the selected content type, a special set of fields appears.
Content Image
type Description example Content example
www.fast-report.com 46 / 451
Content Image
type Description example Content example
www.fast-report.com 47 / 451
Barcode properties
Now let's look at the properties of the QR code. They are available in the object inspector under the Barcode
property.
Property Description
Encoding Text encoding of the barcode content, for example: UTF8, Windows_1251, CP_866, etc. Default: UTF8.
ErrorCorrection Error correction using the Reed-Solomon code. It can take on the following values: L (low - 7%), M
(medium - 15%), Q (25%), H (high - 30%). The default is L.
QuietZone Determines the presence of a white border around the QR code. Default: True (enabled).
The error correction is needed for correct data reading in case of a partially damaged code image or an image
applied over it.
For example, if the redundancy is set to H (30%), the barcode shown below is read without problems:
To hide the text under the code, change the value of the ShowText property to False .
www.fast-report.com 48 / 451
The AutoSize property is used for automatically adjusting the size of the code depending on the size of the
object. If you need to manually resize the barcode (using the mouse), then you need to disable this property
(set to False ). In this case, you need to monitor the proportions yourself.
www.fast-report.com 49 / 451
Swiss QR
Swiss QR is one of the variants of QR codes. In Switzerland, as well as in the whole world QR codes are used
everywhere. However, to use these codes in the sphere of electronic payments it was decided to create its own kind
of QR. Now all the payment receipts and bills in Switzerland should have a QR code with the Swiss cross in the
center is a distinctive feature of the Swiss QR.
FastReport .NET supports Swiss QR code. The code itself looks almost the same as an ordinary QR with the only
difference that there is a Swiss cross in its center:
The essence of this type of code is that it encrypts payment information. To use Swiss QR in the report it is
necessary to add the Barcode object of QR code type to the report page. Further it is necessary to call the QR code
editor by a double click on the object or from the context menu:
www.fast-report.com 50 / 451
This will display the settings for the Swiss code:
www.fast-report.com 51 / 451
Fill in the details of the billing agent. Name of the organization and address.
Reference
A link to the payer's payment, which the recipient of the payment needs.
Type
QRR is a QR link: a Swiss standard link with the length of 26 symbols (only figures);
SCOR - Link of the creditor: the international standard of the link with the length from 5 to 25 symbols;
NON - the link can be empty.
Text type
QR-Reference is used with the type of the reference QRR;
ISO 13616 - is used with the reference type SCOR.
QR-reference is a replacement for the ISR link, which is used now. It helps to go to the new QR accounts with the
used wound of red and orange receipts.
Debitor
Payer data - name or name of the organization and address.
Additional Information
An invoice issuer can enter any additional structured/nonstructured information for the payer.
Currency
Since the payment system is Swiss, two types of currency are assumed: euro and Swiss francs (CHF).
Alternative Procedure 1 and Alternative Procedure 2
It is assumed that in the future billing agents may offer procedures alternative to bank transfers. There are two
fields in Swiss QR for this purpose.
Amount
Here you can specify the amount of payment with comma separator.
As a rule Swiss QR is used in the document Swiss bill. You can find an example of the report with such Swiss
account in the folder Demos/Reports/ .
www.fast-report.com 52 / 451
Aztec codes
Aztec code is one of the types of QR codes. Aztec is the name of the tribe of Indians from Central America. If you
look carefully at the code, in its center you can notice a square, which looks like the Aztec pyramid, if you look at it
from above. This is a special target from which you can determine the center of the code and its orientation.
Aztec Code and combines the best ideas of 2D bar codes: MaxiCode, SuperCode, CodeOne, DataMatrix, DotCode
and PDF417. Despite the patent, this development has become public domain. The coding standard is described in
ISO/IEC 24778:2008.
The size of the code depends on the amount of information being encoded. For example, a minimum size of 15x15
pixels allows you to encode 6 bytes, that is, 12 letters or 13 digits. The maximum size of 151x151 pixels allows
encoding 1914 bytes, 3067 letters or 3832 digits.
Note that the code has two display formats: Compact, where the symbol with the target consists of two squares,
and Full-Range, where the symbol with the target consists of three squares. The choice of format depends on the
amount of data encoded.
The advantage of this type of encoding over others is the ability to read the code in any orientation. Even mirrored,
the code is easy to read. This is achieved by using navigation markers.
Using a target in the center of the code allows you to read information even from distorted or stretched images.
Thanks to Reed-Solomon's encoding algorithm, Aztec Code can also be read with partial damage. In this case,
redundancy is specifically built into the code. It is possible to adjust the percentage of redundancy code from 5 to
95. In this way, it is possible to provide very high resistance to reading errors.
The layer-by-layer structure of the code makes it possible to increase the volume of stored information by
increasing the coding area.
www.fast-report.com 53 / 451
All these advantages made Aztec Code very attractive for use in transport networks as electronic tickets, for
example, in air and rail transportation. In some countries, it is used in government documentation. Like other high-
density codes, Aztec codes are popular in commerce, logistics, manufacturing and pharmaceuticals.
In comparison with a QR code Aztec Code has a higher density of recording and doesn't require fields around the
code. Also the minimum size of Aztec Code is 15x15 compared to 21x21 at QR.
To form Aztec Code in FastReport .NET choose the object Barcode at the components panel in the report
designer. Select Aztec from the drop-down list:
www.fast-report.com 54 / 451
Here you can select a template to encode the information. All except Swiss can be used in Aztec code. For example,
the web site address:
www.fast-report.com 55 / 451
Pharmacode
Pharmacode is a binary code that was developed by German company LAETUS GMBH specifically for
pharmaceutical packaging. It is a subset of CODE39. This code is widely used in the pharmaceutical industry as part
of the product packaging control system.
As part of an automated packaging system, Pharmacode allows easy scanning and recording of pharmaceutical
shipments using universal identifiers. Also, with the help of scanners, it is easy to determine if a batch of drugs has
been mixed with another batch.
The Pharmacode barcode ensures that the code is read, despite possible printing errors. Also, to ensure that the
rest of the package, except the code, is printed correctly, Pharmacode can be printed in different colors (code and
background) as opposed to barcodes intended for reading by laser or laser emulation. This is possible because
Pharmacode is scanned with special white LAETUS scanners. This makes Pharmacode a very practical format for
printing on packaging or documents that do not contain black ink.
As mentioned above, Pharmacode can be printed in different colors. Both the code and the background color can
be different from white and black. There are special specifications for the combination of code and background
colors used depending on the scanner type for reading. For example, standard black and white scanners only
accept contrasting code and background colors, while special scanners that recognize color have no strict
limitations.
Unlike other 1D bar codes, Pharmacode stores data in a binary system, not in a decimal one. In addition,
Pharmacode can only represent single integers from 3 to 131070. The minimum number of lines is 2 for number 3,
and the maximum value is 16 for 131070. Pharmacode reads from right to left, which makes Pharmacode unique
among other linear bar codes that have a start, stop symbol. If you read the code from left to right, you get a
completely different sequence of numbers.
The Pharmacode standard is regulated by the LAETUS developer and is described in the PharmaCode Guide
document.
Here is an example of the Pharmacode:
FastReport.Net allows you to create such codes in your reports. You can design the package in the generator
immediately with the bar code.
To add code to the report page you need to add a Barcode component. Select Pharmacode from the drop-down list:
www.fast-report.com 56 / 451
To edit the code you need to double-click on the added component, or select Edit from the context menu for the
Barcode object:
A numeric sequence may be entered as the code value, a function, a report variable and a database value may be
specified.
In barcode properties, you can change the line spacing (WideBarRatio), code height (Height), and number display
under the code (ShowText).
By default, the barcode is black on a white background. You can change the code color in Barcode -> Color
property. And the background color is in the Fill -> Color property:
www.fast-report.com 57 / 451
As a result of color adjustment, Pharmacode may look like this:
www.fast-report.com 58 / 451
MaxiCode
The MaxiCode 2D bar code has a very unusual appearance. It cannot be confused with another view. It has a round
target for code alignment during scanning. And the encoding elements are points that are lined up in special
combinations and arranged in a cellular structure. A hexagonal (cellular) grid of 888 data-carrying cells.
MaxiCode allows encoding 138 digital characters or 93 alphabetic characters. The barcode is fixed at 1.11 x 1.054
inches. It provides read error correction for code corruption based on Reed-Solomon code. Since most of these
barcodes are on packages, they must be resistant to damage. Error correction allows up to 1/8 of the code to be
corrupted.
Each Maxicode barcode includes two main messages: primary and secondary. The primary message includes a zip
code, country code and class, while the secondary message contains address data.
To read the Maxicode bar code a 2D bar code scanner is required, preferably one that performs keyboard
emulation and is powered by USB port, so no external power supply is required.
The main application of MaxiCode is marking of packages, pallets, etc. It ensures that critical information is
available at all times when the shipment is being processed.
MaxiCode was designed to be included in an existing manifest of delivery systems. Its compact size also allows the
use of MaxiCode to replace less dense characters such as linear bar codes.
One of the key features of MaxiCode is that it can be read at high speed in a large field of view. This means that this
code can be successfully used in automated information processing systems.
To add MaxiCode to the report page, click on the Barcode object on the report designer toolbar and select
MaxiCode in the drop-down list. After that you can place the code on the report page.
www.fast-report.com 59 / 451
To edit the code, double-click the added object or call the context menu for it and select "Edit...". In the barcode
editor you can enter alphanumeric information:
Like all other bar codes in FastReport, MaxiCode can be displayed with or without text information under the code.
The ShowText property is responsible for this.
www.fast-report.com 60 / 451
Plessey/MSI
The Plessey barcode was developed in 1971 by the Plessey Company. This is a classic one-dimensional linear
barcode, which was mainly used for labeling goods on store shelves and in warehouse control. The main advantage
of this code at the time of its creation was the ease of printing on a dot matrix printer. It is currently considered
obsolete and hardly ever found.
Plessey allows you to encode hexadecimal digits (0-F). Each digit is represented by four bits, bars. "Zero" is a thin
bar, "one" is a thick one. In addition to numbers, letters A-F can also be encoded. The barcode has a start code,
encoded data, a checksum code, a finish mark and a reverse reading code (the code can be read in any direction).
MSI has become one of the variations of Plessey. Unlike regular Plessey, it allows you to encode only numbers, and
there is no code for reverse reading. MSI supports several kinds of checksum code, for example: Mod-10, Mod-11,
Mod-1010, Mod-1110.
Both MSI and regular Plessey do not limit the length of the code, but a too long code may simply not fit the
package and the reading scanner is not designed for long length, too. This is what such a long code would look like:
To add the Plessey or MSI barcode to the report page, use the Barcode object on the components sidebar in the
report designer and select the code:
www.fast-report.com 61 / 451
After choosing the type of a barcode, you can place the object on the report page. To edit the barcode, double-click
on the object, or call the context menu and select the "Edit ..." item.
www.fast-report.com 62 / 451
GS1-128
This barcode is also known as EAN-128, UCC-128. It is a one-dimensional linear barcode, with the ability to encode
both numbers and letters. It is most popular in the packaging labeling field, but is also used in other areas. The GS1
Logistic Label standard describes a logistic shipping label that contains the GS1-128 code.
A Code-128 set of identifiers is used to build the barcode. These identifiers indicate the type of information and are
indicated in brackets, for example "(37)". Knowing the data type indicated in parentheses, it becomes clear how to
interpret the subsequent data.
First, the identifier code is indicated in brackets, then its value. Further, without spaces, the following identifier code
and value. Thus, the code will have a value:
(01)12646846874672(10)ABC11(15)100420
11 Production Date 6
12 Due Date 6
13 Pack Date 6
15 ExpirationDate 6
10 Batch No up to 20
37 Number of Units up to 8
If we use the above example when generating this barcode in FastReport .NET, we will get:
To add the GS1-128 barcode to the report page, use the Barcode object on the components sidebar in the report
designer and select the code:
www.fast-report.com 63 / 451
To edit the code, double-click on the added object or select the "Edit ..." item in the context menu:
www.fast-report.com 64 / 451
Intelligent Mail
IMb (Intelligent Mail barcode) (USPS OneCode) - is a height modulated barcode that encodes up to 31 digits of
mail sending data in 65 vertical bars, using symbols with 4 states. This symbolism uses four different states of
"bars", which allows encoding more information in one bar code.
The Intelligent Mail standard was created on the basis of the POSTNET and PLANET standards, which were used in
the USA for mail earlier.
These standards allow for the encoding of zip codes and serve mainly for mail sorting and tracking.
POSTNET is able to encode a five-digit postal code, a 4-digit plus code and a 2-digit delivery point code.
POSTNET bar codes have variable lengths from 32 to 62 bars, while PLANET has 62 or 72 bar codes. They are
modulated in height (vertical columns have different lengths) and 2-states (there are two different bar types, short
and high). Each number of encoded data is represented by a group of five bars. The POSTNET bar codes have
exactly two full bars in each group of five, and the PLANET bar code has three.
IMb technology effectively combines the capabilities of PLANET and POSTNET in one bar code. It allows mail users
to use a single barcode to participate in several mail services at the same time, extends the ability of mail users to
track individual mail items and provides greater visibility of the mail flow. The use of this barcode allows the Postal
Service to provide multiple services to the mailing industry and additional mail tracking features, as well as to track
mail performance and reduce costs. Like POSTNET IMb, it has a checksum to check the integrity of the code and
possible recovery of damaged code.
Compared to POSTNET IMb, it has a much larger data capacity (31 characters versus 11). In addition to the routing
code, the Intelligent Mail barcode includes four additional fields: barcode identifier, service type identifier (STID),
mail program identifier (MID) and serial number. These additional fields allow mail users to define the class of mail,
identify the services they want to purchase (e.g., tracking and correcting the address), and allow mail clients to
uniquely identify mail items.
The disadvantages include a sufficiently long code and the ability to encode only numbers.
Intelligent Mail allows encoding the following information:
Information Description
Serial number (6 or 9 characters) The sender is assigned a number to identify a specific recipient or
household
www.fast-report.com 65 / 451
Information Description
Then, to edit the code, double-click the added object, or call the context menu for it and select "Edit...".
In FastReport, the minimum length of the code is 20 characters. This is due to the fact that with 21 characters
begins the Postal Code of the delivery point, which is not required.
Changing just one digit completely changes the barcode:
www.fast-report.com 66 / 451
PDF417
It is a common 2D barcode for encoding large amounts of data. Its abbreviation stands for Portable Data File, and
the number 417 was formed as a result of the addition of 4 and 17. Here 4 is four bars and four spaces, and 17 is
the number of modules in the code word.
As noted above, PDF417 is a widely used barcode, along with QR Code, Maxi Code and Data Matrix. PDF417 looks
like a mixture of the classic linear and matrix barcodes, but in fact it is a complex linear code. Along the edges it has
bars, as in ordinary linear codes, and in the middle, the bars are arranged in lines one above the other. It turns out
such a compression of the linear code due to the arrangement of bars with codes one above the other. This allows
you to store large amounts of information - from 3 to 90 bars, in which you can encode up to 1859 alphabetic
characters or 2725 numeric characters.
Code corruption protection provides redundancy that can cover up to 50% of the code. This is a very high number,
but the size of the code will grow as well. Compared to matrix codes, PDF417 takes up several times more space
when encoding the same amount of information which can be considered a disadvantage.
The scope of PDF417 is quite extensive. It is used by: transport companies for printing on passenger tickets and
cargo shipments, in postal items, reporting documents, various identity cards, warehouse accounting, and in many
other areas where labeling and identification is required.
To read this barcode, laser scanners are used, and they are slightly different from conventional line code scanners.
As mentioned above, there are normal lines on the sides of the code, typical for linear barcodes. They are needed to
identify the beginning and end of the code.
To add the PDF417 barcode to the report page, use the Barcode object on the components sidebar in the report
designer and select PDF417:
www.fast-report.com 67 / 451
Now you can place the barcode on the report page. To edit it, double-click on the added object, or call the context
menu and select "Edit ...". After that, the Barcode editing window will appear:
In the added Barcode object property inspector, you can turn off the display of text under the code using the
ShowText property.
www.fast-report.com 68 / 451
EAN – 8
EAN - 8 (European Article Number), also known as GTIN - 8, is a short 8-digit barcode. The numbers are divided
into 2 blocks of 4 numbers. The first 2 digits identify the country of origin of the goods, then 5 digits are the
encoded information, and the last digits are the checksum to verify the integrity of the data.
This code is based on EAN-13, but the size of the code is reduced to 8 digits.
This code was created on the basis of EAN - 13, by reducing the size of the code to 8 digits. This made it possible to
place code on small packages. As soon as there is a country identificator in the code, it is considered international.
EAN is used in trade to identify products and equipment.
How the code is formed. Each digit is encoded in 7 units (vertical lines and spaces). Let's say 0 is a space and 1 is a
line. Then the encoding of the numbers can be represented as follows:
0 – 0001101;
1 – 0011001;
2 – 0010011;
3 – 0111101;
4 – 0100011;
5 – 0110001;
6 – 0101111;
7 – 0111011;
8 – 0110111;
9 – 0001011.
Let's see in this example:
Remember that the code starts with 101. Then follows the code for the number 3 and so on. As mentioned above,
the code is split into two parts. The separator line, as well as the code beginning and the end lines, is long. It is
represented by 01010 code.
If you look closely, you will notice that the lines after the separator do not correspond to the numbers from the
above list. This is because a different encoding is used for the second part:
· 0 – 1110010;
· 1 – 1100110;
· 2 – 1101100;
· 3 – 1000010;
www.fast-report.com 69 / 451
· 4 – 1011100;
· 5 – 1001110;
· 6 – 1010000;
· 7 – 1000100;
· 8 – 1001000;
· 9 – 1110100.
To add an EAN-8 barcode to the report page, use the Barcode object on the components sidebar in the report
designer and select the code:
To edit the code, double-click on the added object or select the "Edit ..." item in the context menu:
www.fast-report.com 70 / 451
You can hide the numbers below the code using the ShowText property in the Property inspector of the Barcode
object:
www.fast-report.com 71 / 451
EAN-13
The EAN-13 (European Article Number) barcode is the most commonly used linear barcode symbology. 12 digits
can be incoded with this system of characters, the last 13th digit of the code is a checksum for checking the
integrity of the code. Only digits are allowed.
The physical structure of the code is as follows:
The first 2-3 digits are used to encode the country of the product manufacturer;
Next 4-5 digits are used to encode the manufacturer of the goods;
The remaining 3-5 digits are the product number at the enterprise.
As already mentioned, the 13th digit is the checksum. It is calculated automatically based on the previous 12 digits
using a special algorithm. Thanks to this digit, you can determine whether the code has been read correctly.
If we look at the appearance of the code, we will notice that at the beginning and the end of the code there is a
sequence of two bars. If we represent the code as a binary sequence, where the bar is -1 and the space is 0, then
this barcode looks like 101. In addition, the barcode is divided into two parts exactly in the middle by the same
sequence.
Each character is encoded in 7 elements (bars and spaces). There are three special tables with code sequences for
digits. Moreover, the first and the second halves of the code use different versions of such tables.
This code can be read in any left-to-right or right-to-left sequence. Its simplicity and ease of reading quickly made it
popular in the retail industry for product labeling.
The low capacity of this code (the lenght of the encoded sequence) is often mentioned as the disadvantage.
To add an EAN-13 barcode to the report page, use the Barcode object on the components sidebar in the report
designer and select the code:
www.fast-report.com 72 / 451
To edit the code, double-click on the added object or select the "Edit ..." item in the context menu:
You can hide the numbers below the code using the ShowText property in the Property inspector of the Barcode
object:
www.fast-report.com 73 / 451
www.fast-report.com 74 / 451
MSI
MSI linear bar code was created in 1971 on the basis of Plessey bar code and is essentially its improved version. It
can only encode numbers from 0 to 9. Code structure:
Start character indicating the beginning of data reading (110);
Data;
Optional check character;
Stop symbol indicating the end of data reading (1001).
Each character in the code is represented in binary form with bars and spaces. Barcode is 1 and space is 0.
The control character can be calculated by one of four types: Modulo 10, Modulo 11, Modulo 1010, Modulo 1110.
The most common type is Modulo 10. By a certain algorithm is calculated the control character. The data read by
the scanner is added up by the algorithm and the result is compared with the control character. If the result is
positive, the code is considered to have been read correctly.
MSI - code of any length. It is limited only by the capabilities of the scanner.
Now this barcode is considered obsolete and practically is not used. Previously, it was used to mark goods in
warehouses and supermarkets.
To add MSI code to a report page, click the barcode icon on the side panel of components in the report designer :
www.fast-report.com 75 / 451
In a drop-down list, select MSI. Add the selected bar code to the report page. To edit a bar code, double-click the
added bar code, or call the context menu for it and select Edit:
To remove the display of text under the code, select the added barcode and change the value of the ShowText
property to False:
www.fast-report.com 76 / 451
The "CheckBox" object
The object displays the checkbox in the report. It looks as follows:
The object can display two states: "Checked" and "Unchecked". Use the following ways to handle the object's state:
set the state in the "Checked" property;
bind the object to a data column using the "DataColumn" property;
set the expression that returns the true or false in the "Expression" property.
The "CheckBox" object has the following properties:
Property Description
CheckedSymbol, These properties determine the symbol that is shown in the object, depending on the object's
UncheckedSymbol state.
CheckWidthRatio Use this property to set the check width ratio. The width of the check symbol depends on the
size of the object. You can use values in the 0.2 - 2 range.
DataColumn The data column which this object is bound to. The type of column should be either bool or int.
www.fast-report.com 77 / 451
The "Table" object
The "Table" object is made up of rows, columns and cells. It is a simplified analog of Microsoft Excel table. It looks
like this:
You can learn more about this object in the "Creating reports" chapter.
The "Table" object has the following properties:
Property Description
ColumnCount Use this property to quickly set the number of columns. If columns in a table are few, they get added,
and when they are more, they get deleted.
RowCount Use this property to quickly set the number of rows. If rows in a table are few, they get added, and
when they are more, they get deleted.
FixedColumns The property determines how many columns in the table are fixed. Fixed columns form the table header.
Printing of the header is controlled by the "RepeatHeaders" property.
FixedRows The property determines how many rows in the table are fixed. Fixed rows form the table header.
Printing of the header is controlled by the "RepeatHeaders" property.
RepeatHeaders The property allows printing the table header on every new page. This property works only for tables
which are formed dynamically.
www.fast-report.com 78 / 451
The "Matrix" object
The "Matrix" object is, like the "Table" object, made up of rows, columns and cells. At the same time, it is not known
beforehand how many rows and columns will be in the matrix - this depends on the data to which it is connected.
The object looks like this:
You can learn more about this object in the "Creating reports" chapter.
The "Matrix" object has the following properties:
Property Description
RepeatHeaders If matrix is divided on several pages, this property allows printing matrix header on each new page.
CellsSideBySide This property determines how matrix cells will be located if the matrix has several data cell levels.
Possible variants:
Style Using this property you can set a style for the whole matrix. You can choose one from predefined
styles.
AutoSize This property allows to calculate the matrix size automatically. Disable it if you want to control the
object size manually.
DataSource The property allows connecting the matrix to the data source. This property is set up automatically
when you drag data column to the matrix. However, if you use expressions in cells,check that this
property was set up correctly.
Filter This property contains expression for data filtering which will be applicable to data source of the matrix
(see "DataSource" property).
www.fast-report.com 79 / 451
Advanced Matrix Object
This object, like the "Matrix" object, allows you to build summary reports.
You can read more about this object in the chapter "Advanced Matrix" object.
www.fast-report.com 80 / 451
The "Chart" object
The "MS Chart" object allows to display charts. There are more than 30 different series types available - bars,
columns, areas, lines, bubbles, pie, circular, financial, pyramidal, ranges. The object looks like this:
You can learn more about this object in the "Report creation" chapter.
The "Chart" object has the following properties:
Property Description
www.fast-report.com 81 / 451
The "Zip Code" object
The "Zip Code" object allows to print a zip code on envelopes. It may display numeric characters (0-9).
The object is as follows:
You can connect an object to data by using one of the following methods:
set the zipcode data in the "Text" property;
bind the object to a data column using the "DataColumn" property;
set the expression that returns the zipcode data in the "Expression" property.
The "Zip Code" object has the following properties:
Property Description
SegmentWidth, The size of a single code segment. The default size is 0.5х1cm.
SegmentHeight
Spacing This property determines a distance between two segment's origins. The default value is
0.9cm.
ShowMarkers Determines whether it is necessary to display the markers (bold horizontal lines above the
zipcode).
www.fast-report.com 82 / 451
The "Cellular Text" object
This object can display each character of a text in its individual cell. It is often used to print some forms in financial
applications.
The object is as follows:
In fact, this object is directly inherited from the "Text" object. You may connect it to data in the same manner. For
example, you may invoke the object's editor and type the following text:
[Employees.FirstName]
Property Description
CellWidth, These properties determine the size of a single cell. If both properties are 0 (by default), the cell size will
CellHeight be calculated automatically, depending on the font used.
HorzSpacing, These properties determine the horizontal and vertical gap between adjacent cells.
VertSpacing
www.fast-report.com 83 / 451
Gauge objects
These objects are intended to visually display any value. Here's what the four different gauge types currently
supported look like:
Linear Gauge
Simple Gauge
Radial Gauge
Simple Progress Gauge
To add the Gauge object to your report, select one of the options from the submenu that opens when you click
button:
You can change some aspects of the gauge appearance, such as the color of the pointer. To edit the gauge
parameters, double-click on it with the left mouse button, or select "Edit ..." in the context menu.
www.fast-report.com 84 / 451
The Expression button will open a text editor where you can enter the gauge value yourself, or compose an
expression for it and connect the gauge to the data.
www.fast-report.com 85 / 451
The "Digital Signature" object
The digital signature - cipher that guarantee uniqueness and originality, allowing to unequivocally establish
authorship and protect against document changes. Thanks to reliable encryption algorithms, such signatures are no
worse than handwritten, and even better, more reliable.
In the current version two types of signatures are available:
1. Signing field (signature field) - implies the presence of a special field in the document, by clicking on which,
the user will be able to attach his certificate;
In the report view it is invisible. Its functionality is limited solely to PDF export. That is, you will see this field when
viewing a PDF file in Acrobat Reader.
After export, the field will look like this:
Click on the signature field and see the window for choosing a certificate to sign the document:
2. Invisible signature – then sign with a certificate. It is not visible visually, but in document properties one can
get information about the signatory, authenticity of the signature, version of the document at the moment of
signing and other information.
In order to sign an exported PDF file with an invisible signature, you do not need to add the "Digital Signature"
object to the report page. You need to enable the signing option in the export settings, and select a certificate there
as well:
www.fast-report.com 86 / 451
www.fast-report.com 87 / 451
Your first report in the FastReport
Let us create a simple report, which prints a list of products. We will use the Products table, which can be found in
the demo data base as our data source.
Assuming that, you will be performing the actions written below in the demonstration program, Demo.exe, from
which the report designer can be called.
www.fast-report.com 88 / 451
Example 1. Creating a report manually
In this example, we will create a report manually. For this, we will do the following:
press the button on the toolbar, and in the "Add New Item" window, choose "Blank report";
in the "Data" menu, choose the "Choose Report Data..." item and check the "Products" data source:
switch to the "Data" service window (if it is not on the screen, it can be shown by choosing the "Data|Show
Data Window" menu item). Expand the "Data Sources" item, then the "Products" item:
drag the "ProductName" data column onto the "Data" band. FastReport creates a "Text" object, which is
connected to this column and a header for it;
we will create the "UnitPrice" data column by using another method. For this, press the "Text" button on the
"Objects" toolbar:
leave the mouse and drag its pointer onto the "Data" band - you will see that FastReport offers to insert an
object. Choose the needed position and click the mouse to insert the object;
-
www.fast report.com 89 / 451
place the mouse pointer on the object and click the small button in the right corner of the object. You will see
a list of data columns. Choose the "UnitPrice" item from the list:
create the "Text" object - header for the "UnitPrice" column. Place in on the "Page Header" band. Double click
the object and write the text "Unit Price";
create the "Text" object - report title. Place it on the "Report Title" band and write the text "PRODUCTS";
set "Bold" as font style for all objects that are placed on the "Page Header" and "Report Title" bands. For this,
select objects by pressing Shift, and press the button on the "Text" toolbar. After this, the report will be
looking like this:
In order to run the report, click the button on the toolbar. The report will be built and shown in the preview
window:
www.fast-report.com 90 / 451
Example 2. Creating a report with the wizard
In this example, we will create a report with the help of the "Standard Report Wizard". For this, do the following:
press the button on the toolbar and in the "Add New Item" window, choose "Standard Report Wizard":
on the first step of the wizard, choose the "Products" table and click the "Next" button:
on the second step of the wizard, choose the "ProductName" and "UnitPrice" data columns:
www.fast-report.com 91 / 451
the rest of the steps can be skipped, click the "Next" button;
on the last step of the wizard, choose "Blue" style and click the "Finish" button:
To run a report, click the button on a toolbar. The report will be built and shown in the preview window:
www.fast-report.com 92 / 451
www.fast-report.com 93 / 451
Report creation
In this chapter we will look at the methods of creating common types of reports. In order to create any report, as a
rule, you need to do the following:
1. Choose or create data, which will be used in the report.
2. Create the report structure, by adding the needed bands into the report.
3. Connect the band to a data source.
4. Place the "Text" objects on the bands to print data.
5. Setup the appearance, formatting.
www.fast-report.com 94 / 451
Choosing data for a report
Before you start building a report, you need to choose the data which will be printed in the report. You can do this
in two ways:
you can choose one of the data sources, which was registered in the report by a programming method. This
can be done in the "Data|Choose Report Data..." menu, by marking the needed data source:
you create a new data source in the "Data|New Data Source..." menu.
Read more about data sources in the "Data sources" chapter.
Just after you have chosen the data source, it appears in the "Data" window. Now you can use this source in the
report. Many reports use only one data source. For reports of "master-detail" type, you need to choose two data
sources, related to each other (you can read more about relations in the "Data sources" chapter). Several data
sources can also be needed in a report, which prints data from related sources.
www.fast-report.com 95 / 451
Dynamic layout
It is necessary often to print a text whose size is not known when creating a report. For example, this can be a
description of goods. In this case, the following tasks will need to be solved:
calculate the height of the object, such that it encloses the whole text;
calculate the height of the band, such that it encloses the object with a variable amount of texts;
move or change the height of other objects, which are contained on the band, such that, they do not disturb
the general design of the report.
These tasks can be solved by using some object and band properties:
"CanGrow" and "CanShrink" properties allow calculating the height of the object automatically;
"ShiftMode" property allows moving objects that are located under the objects that expand;
"GrowToBottom" property allows resizing an object to the bottom edge of the band;
"Anchor" and "Dock" properties allow controlling the size of objects depending on the size of the band.
All these properties will be looked at below.
www.fast-report.com 96 / 451
CanGrow, CanShrink properties
Every band and report object has these properties. They determine whether an object can grow or shrink
depending on the size of its contents. If both properties are disabled, the object always has the size specified in the
designer.
These properties are very useful, if it is needed to print a text whose size is not known when designing. In order for
an object to accommodate the entire text, it needs to have the "CanGrow" and "CanShrink" properties enabled:
www.fast-report.com 97 / 451
ShiftMode property
Every report object has this property. This property is accessible only in the "Properties" window. An object, whose
"ShiftMode" property is enabled, will be moving up and down, if the object above on can either grow or shrink.
www.fast-report.com 98 / 451
GrowToBottom property
Every report object has this property. When printing an object with this property, it stretches up to the bottom edge
of a band:
This is needed when printing information in a table form. In a table row there can be several objects which can
stretch. This property makes it possible to set all objects' height to the maximum height of the band.
www.fast-report.com 99 / 451
Anchor property
Every report object has this property. It determines how the object will be changing its position and/or its size when
the container on which it is laying will be changing its size. By using Anchor, it can be done in such a way that, the
object expands or moves synchronously with its container.
The container, being referred to, in many cases will be the band. But this is not a must - this can also be the "Table"
or "Matrix" objects.
The "Anchor" property can have one of the following values, and also any combination of them:
Value Description
Left Anchors the left edge of the object. When the container's size will be changing, the object will not be moving
left/right.
Top Anchors the top edge of the object .When the container's height will be changing, the object will not be moving
up/down.
Right Anchors the right edge of the object .When the container's width will be changing , the distance between the
right edge of the object and the container will be constant. If the left edge of the container is anchored as well,
then the object will be growing and shrinking synchronously with container.
Bottom Anchors the bottom edge of the object. When the container's height will be changing, the distance between the
bottom edge of the object and the container will be constant. If the top edge of the object is anchored as well,
the object will be growing and shrinking synchronously with container.
By default, the value of this property is Left, Top. This means that, when the container's size will be changing, the
object will not be changing. In the table below, combinations of some frequent used values are given:
Value Description
Left, Top Value by default. The object does not change when the size of the container changes.
Left, Bottom The object moves up/down when the height of the container changes. The position of the object in
relation to the bottom edge of the container does not change.
Left, Top, When the height of the container is changing, the height of the object synchronously changes with it.
Bottom
Left, Top, When the width and the height of the container are changing, the object grows or shrinks synchronously
Right, Bottom with it.
Value Description
Left The object is docked to the left edge of the container. The height of the object will be equal to the height of the
container*.
Top The object is docked to the top edge of the container. The width of the object will be equal to the width of the
container*.
Right The object is docked to the right edge of the container. The height of the object will be equal to the height of the
container*.
Bottom The object is docked to the lower edge of the container. The width of the object will be equal to the width of the
container*.
Fill The object occupies all the free space of the container.
This is not quite so, if several objects have been docked at the same time. The figure below shows two objects,
the first one has been docked to the top edge of the container and the second - to the left:
As seen, the height of the second object is equal to height of the free space, which remains after docking the first
object.
The docking behavior depends on the object's creation order. You can change the order in the context menu of
an object. To do this, select either the "Bring to front" or "Send to back" menu items.
The object's border consists of four lines. Each line can have different width, color and style. The toolbar buttons
affect all lines of frame. The button displays a dialog which allows to set up each line separately:
To work with fill, there are two buttons on the toolbar. The button allows to choose a color for the solid fill type.
The button displays a dialog which allows to choose between different fill types:
The list of styles is stored in a report. You can control it either from the "Report|Styles..." menu or by the button
in the "Style" toolbar:
If the toolbar is not present on the screen, enable it in the "View|Toolbars" menu.
When you set the object's style, the object's appearance will be changed according the style settings. When you
change the style settings, the object with that style will change automatically.
11.10.2008 18:04:52
If you need to print the date part only, you have to set up the data formatting. To do this, right-click the "Text"
object to show its context menu. In the menu, choose the "Format..." item. You will see the format editor window:
You may choose one of the available formatting types or set up own formatting string. To do this, select the
"Custom" formatting. If the "Text" object contains several data columns or expressions, you may choose
appropriate format for each of them. To do this, select the expression in the top of the window, then choose the
format:
It is possible to define one or several conditions and set up the style for every condition. Style can contain one or
several settings:
fill;
text color;
font;
object's visibility.
You can indicate, which settings need to be changed when the condition is met. For this, check the needed setting
using the checkbox. By default, a new style contains one setting - the text color.
In order to create a new condition, click the "Add" button. You will see an expression editor:
Here, it is possible to write any expression which returns a boolean result. In many cases you will use the "Value"
variable, which contains the currently printing value.
Let us look at the following example: we have a "Text" object, in which we print the amount of products in stock:
We want to paint the object red, if the amount of products = 0. For this, we create the following condition:
Value == 0
In the given case, we used the "Value" variable, which has got a printed value. If there are several expressions in an
object, then this variable will have the value of the last expression. Instead of "Value", you can use a data column:
[Products.UnitsInStock] == 0
The expression is written in C# style. This is so, if the chosen report language is C#. For VisualBasic.Net you
must use the single "=" sign. The report language can be changed in the "Report|Options..." menu.
Configure the style for the given condition in such a way that only fill can be used, and choose the red color:
When printing an object which has a zero value, it will be red. Let us make our example more complex, we will add
another condition. If the units in stock is less than 10, it must be printed yellow. To do this, open the condition
editor and click the "Add" button. The second condition will be like this:
Value < 10
In case where several conditions have been indicated, FastReport checks all the conditions, starting from the first
one. If a certain condition is met, FastReport applies its style settings to the object, and the process stops. It is
important to put the conditions in a correct order. The order which we have seen in this example is correct:
1. Value == 0
2. Value < 10
In the given case, the "Value==0" will not be executed, because when the value is zero, then the first condition will
be met. In order to change the order of the conditions, use the and buttons.
If the value of variable CountOfElements is equal to 0, and the property HideZeros is set to true, the object will be
printed as follows:
Total elements:
The "Text" object also has the "HideValue" property which can be used to hide the value of an expression which is
equal to the given value. For example, if the property value is "0", then all the zero fields will be hidden. This
property can also be used for hiding zero dates. As a rule, it's a date like "1.1.0001" or "1.1.1900". In this case the
value of "HideValue" property must be like this:
1.1.1900 0:00:00
As you can see, apart from the date, you need to indicate time as well. This is necessary because the value of the
date in .Net contains time also.
Important note: this mechanism depends on the regional settings of your system, which can be set in the
control panel. This happens because FastReport compares strings using the "ToString()" method. This method
converts an expression value into a string. In relation with this, be careful when building reports which can be
launched on a computer with different regional settings.
Finally, the "NullValue" property of the "Text" object allows to print some text instead of a null value. It is often used
to print the dash instead of a null value. Lets look at an object with the following contents:
If the value of variable CountOfElements is null, and the property NullValue is set to --, the object will be printed as
follows:
Total elements: --
It is preferable to use the "EvenStyle" property of the object instead of the band. This avoids possible problems
when exporting the report.
If the "Data" band is not connected to the source, it gets printed once.
When you create a new report, it already contains several empty bands, including the "Data" band. This band can
also be added into the report from the "Configure Bands" window, by choosing the "Report|Configure Bands..."
menu item.
In order to connect a band to data, double click it. Choose data source in the editor window and click "ОК":
As a sort criteria, you can use either a data column or an expression. You can indicate several (not more than three)
sorting conditions. This can be needed, for example, if you want to sort the list of customers by their cities, and after
that, by customer's name. For each condition, you can choose the order of sorting - ascending or descending.
Another method of sorting data - use the SQL query as a data source. The query will be executed on the data server
and return a sorted rows.
As a filter expression, you can indicate any correct expression. More details about expressions can be found in the
"Expressions" chapter.
In the example above the following filter is used:
[Products.Discontinued] == false
This means that, all the data rows whose Disconnected flag is equal to false will be chosen.
You can use complex filter condition:
This means that, all the data rows whose Disconnected flag is equal to false, and whose price is less than 10 will be
chosen.
This filtration method supposes that, the data source contains all rows, part of which will be filtered. If the data
source contains a large amount of rows, this can seriously slow down the report. In this case you can use SQL
query as a data source, in which you can perform the needed filtration. The query will be executed on the data
server and return only those rows which are needed in the report.
You also may use dialogue forms to perform data filtering. See more details in the "Dialogue forms" chapter.
when printing one list, if the list does not fit on one page of the prepared report. By using the "Repeat On
Every Page" property of the data header/footer, you can print these bands on every page of the report:
Break algorithm does not always work correctly. The artifacts can occur in a situation, when there are several
objects with different font size on a band.
The goal of band breaking is to save the space on the printed sheet. Data keeping's goal is contrary: display a set of
bands wholly on one sheet. In this case there will be a lot of unused space on the sheets, but the data is printed in a
way that it is comfortable to percept.
The "keep together" mechanism allows keeping a set of bands together on one page (or column, if the report has
columns). If, when printing, kept data reaches the end of the page, FastReport relocates all data which has been
printed already onto a new page.
You can use the "keep together" in the following cases:
printing all the rows of the "Data" band together;
printing all the elements of a group (header, data, footer) together;
printing the row of the master data source together with all detail rows (in the "master-detail" report);
printing the report header or the data header together with at least one data row;
printing the report footer or data footer together with at least one data row;
printing the parent and child bands together.
Let us look at the use of "keep together" mechanism.
To keep together all data rows or group elements (header, data, footer), enable the "KeepTogether" property. This
property is used in the "Data" and "Group Header" bands. The figure below shows how data is printed with and
without keeping together:
To prevent "hanging" headers and footers, use the "KeepWithData" property. The following bands have got this
property:
report header;
report footer;
data header;
data footer;
group header;
group footer.
This property allows to keep header/footer with at least one data row:
In order to keep a band and its child band together, enable the "KeepChild" property.
If the data source has more rows than indicated in the "CompleteToNRows" property, then an empty row will
not be printed.
Another way to print an empty row is to fill the free space on a page. In this case, the "Child" band is attached to the
bands of either the "Data Footer" or "Group Footer" types and fills the free space on the page. The footer band will
be printed at the bottom of the page.
In order to print an empty row this way, attach the "Child" band to the footer band and enable its "FillUnusedSpace"
property. You will see that the child band is now displayed above the band it is attached to. In the figure below, the
"Child" band is attached to the "Report Summary" band:
Set the "Data" band properties, which is responsible for the hierarchy, in the following way:
In this example, the picture object has Anchor property set to Left, Top; the object with job title is anchored to Left,
Right, Top; the object with the name is anchored to Right, Top.
In order to add a detail data band, call the "Configure Bands" window. This can be done by pressing the "Configure
bands..." button, shown in the figure, or by choosing the "Report|Configure Bands..." menu item. In the
configurations window, the band structure is displayed:
Select the "Data" band, as shown in the figure, and right click the mouse in order to show the context menu (or
press the "Add" button in the lower part of the window). In the window which will open, select "Data" band:
Nested data bands are clearly seen on band structures on the left part of the window. After this, you need to
connect the band to the corresponding data source and place data columns on the bands. We will be using two
data sources - Categories and Products - from the demo data base which comes with FastReport:
Right click on an empty place of the list, as shown in the figure, and select "Data" band in the context menu. This
creates a new independent "Data" band. The report template will be like this:
Now, we will connect the band to the data source and place several data columns on it:
In this way, it is possible to add an unlimited number of detail bands to the master "Data" band. An example report
structure can be like this (this is just an example; it only demonstrates the abilities of FastReport):
The area shown in grey should never be used for placing objects on it. It is used to print next columns' objects.
For working with columns, the "Column Header" and "Column Footer" bands are used. As seen from their names,
they print at the top and the bottom of every column respectively. The following figure demonstrates the bands
printing order in the report with columns:
In this mode, FastReport calculates the number of data rows in a column in such a way that, columns are filled
equally. You can also set the minimum number of rows in a column with the "Columns.MinRowCount" property.
For creating the "Table of Contents" section, you can use the technique described in the "Interactive reports"
chapter.
If you need to start the page on an odd page number, set the "StartOnOddPage" property to true. When needed,
FastReport prints the empty page before starting to print the indicated page.
This property determines on which pages the object can be printed. The property can have one of the following
values or any combination of it:
FirstPage;
LastPage - the report must be double-pass;
OddPages;
EvenPages;
RepeatedBand. This value refers to a band with the "RepeatOnEveryPage" property set to true;
SinglePage - the report must be double-pass.
By default, the value of this property equals to "FirstPage, LastPage, OddPages, EvenPages, RepeatedBand,
SinglePage". This means that the object will be printed on all pages of the report. In case the report has single page
only, the object's visibility is determined by the SinglePage value only.
We will give several typical examples of using this property:
FirstPage, LastPage, OddPages, EvenPages On all bands except the repeated one.
For example, to print different text on odd and even pages, put two "Text" objects on a band and setup them in the
following way:
the first object will be printed on odd pages. Set its "PrintOn" property to "FirstPage, LastPage, OddPages,
RepeatedBand" (i.e. all values except "EvenPages").
the second object will be printed on even pages. Set its "PrintOn" property to "FirstPage, LastPage, EvenPages,
RepeatedBand" (i.e. all values except "OddPages").
These objects will never be printed at the same time. You could place them on top of each other.
A group always contains a header and data. Group footer is optional, you can delete it.
In order to use a group, you should set the group condition for the group header, and connect the data source to
the "Data" band. The condition can be any expression, but as a rule, this is one of the data source columns. Group
printing is done in the following way:
1. group header is printed.
2. data row is printed.
3. checks if the grouping condition has changed.
4. if the condition has not changed, next data row is printed (p.2).
5. if the condition has changed, the group footer is printed, and starts printing a new group (p.1).
Assuming that we have a Products table with the following data:
Data can be grouped on the CategoryName column. This column will be printed in the group header. The data itself
is presented by the ProductName field. The report will be as follows:
In order to configure a group, double click the "Group header" band. You will see the group header editor window:
You need to set the group condition. This can be any expression or data source column. Also choose the sorting. By
default, data is sorted in ascending order.
Second method: you use the wizard, which can be called from the "Report|Group Expert..." menu. In order to create
a group, enter the group condition and press the "Add" button:
After this, call the editor of the added group and set up the group condition.
In the second case, you use the group expert which we have looked at already. Set the grouping condition and click
the "Add" button. The wizard will add the new group to the existing one.
Printing of the nested group does not differ much from printing of an ordinary group. When printing data,
FastReport will check all group conditions of all groups. If the condition changes, the corresponding group finishes
and a new group starts printing.
With the help of the wizard you can either add or delete a group, and change the grouping order as well. For
changing the grouping order, the buttons and are used. With the help of the "Edit..." button, you can change
the group condition of the chosen group.
In order to display the value of the total, drag it onto the group footer:
In this report, the group footer has two objects, placed one on top of the other:
The new page will not be added before the first group. This is done in order to avoid an empty first page.
The "ResetPageNumber" property allows resetting the page number when printing the group. Usually it is used
together with the "StartNewPage" property. As a result, if both of these properties are enabled, every group will be
printed on a new page, and will have its own page numeration.
Since subreport is formed on the sheet of the main report, it cannot contain the following bands: "Report
header/footer", "Page header/footer", "Column header/footer", "Overlay".
To place other objects under the subreport, use the "Child" band. Place the objects in the following way:
The second printing mode differs in that subreport's objects are printed on the band, which contains the
"Subreport" object. You can enable this mode from the context menu of the "Subreport" object. To do this, select
the "Print on Parent" item. This mode does not put a limit on placing of the objects. Apart from that, in this mode, a
parent band can either grow or shrink depending on how much data has been printed in the subreport.
The only problem with the second mode is that there may be a lot of data in the subreport. When printing it, the
parent band will have a big height. In order to print such a band correctly, it is required to break its contents
("CanBreak" property). The break algorithm does not provide 100% quality and in some cases it can lead to the
displacement of objects.
select a column and indicate the needed width in the "Width" properties. This property is accessible in the
"Properties" window.
You can also enable the "AutoSize" column property. When running the report, the width of the column will be
calculated automatically. In order to limit the width of the column, you can indicate the "MinWidth" and
"MaxWidth" properties.
Width of the column should never be larger than the page's width.
Left click and move the mouse, in order to change the size of the row.
select the row and indicate the needed height in the "Height" property. This property is accessible in the
"Properties" windows.
You can also enable the row's "AutoSize" property. When the report is run, the height of the row will be calculated
automatically. In order to limit the height of the row, you can use the minimum height ("MinHeight") and Maximum
height ("MaxHeight") properties:
Height of the row should never be larger than the page's height.
In order to split a cell, call its context menu and choose the "Split cell" item.
A cell serves as a container to objects placed into it. This means that, you can use the "Dock" and "Anchor"
properties of an object inside the cell. This allows changing the size of the object when the size of the cell is
changing.
This mode is connected with programming and needs higher qualifications from the report developer.
Formation of the table is done with the help of script. In order to create a script, select the "Table" object, in the
"Properties" window click the "Events" button and double click on ManualBuild event:
When this is done, an empty event handler is added into the report code:
In this mode, the source table is used as a template. In the event code, you can print rows and columns from the
source table as many times as it is needed. During this, the resulting table will be formed, which can contain an
unlimited number of rows and columns. Such a table can split across pages if it does not fit on the report page.
For printing a table, the following methods of the "Table" object are used:
PrintRow int index Prints the row with the specified index. Row numbering starts from 0.
PrintColumn int index Prints the column with the specified index. Column numbering starts from 0.
PageBreak - Inserts a page break before printing the next column or row.
Every row of the table must contain the same number of columns. Keep it in mind, when using the
PrintColumn(int index) and PrintColumns(int [] indices) methods.
The second method - printing from left to right, then from top to bottom. This method is better for printing a table
with a variable number of columns. You must call the methods in the following sequence:
PrintColumn(column index);
one or several calls of the PrintRow(row number) or PrintRows(rows indices) for printing the indicated rows;
or one call of the PrintRows() method for printing all rows;
repeat this sequence in order to print all the needed columns of the table.
Every column of the table must contain the same number of rows. Keep it in mind, when using the PrintRow(int
index) and PrintRows(int [] indices) methods.
Violation of the order of calling the printing methods leads to errors when executing the report. One of the errors -
attempting to print the table with the help of the following code:
Table1.PrintRows();
Table1.PrintColumns();
This sequence of methods is not correct. You must start printing the table with either the PrintRow or PrintColumn
method.
We will create a ManualBuild event handler, which will be printing the first column 3 times and the second column
1 time:
Pay attention that we have printed the same number of columns in every row. If this rule is violated, then we
will get an unpredictable result.
As seen, the header cell is spanned automatically. We will make the code a little more complex, so that two groups
of columns can be printed:
Table1.PrintColumn(1);
the header is finished and further printing of the first column starts a new header:
// group 2
Table1.PrintColumn(0);
Sum TableCell cell Returns the sum of the values contained in cell.
Min TableCell cell Returns the minimum from the values contained in a cell.
Max TableCell cell Returns the maximum from the values contained in a cell.
Avg TableCell cell Returns the average of the values contained in a cell.
Count TableCell cell Returns the number of rows, contained the specified cell.
In an ordinary printing mode (not dynamic) these functions will not work.
In order to use the total function, place it in the cell of the table. For example, the following function calculates the
sum of the values contained in a cell named "Cell1":
[Sum(Cell1)]
During this, all the cells located higher and on the left of the current cell (in which we are calculating the sum)
are analyzed.
Value Description
To start, select the table and create an event handler for "ManualBuild" event.
As a result, the following table will be printed, which does not differ from the template:
In this example, the middle row gets printed 3 times. As a result, we get the following:
As a result, the following table will be printed, which does not differ from the template:
In this example, the middle column of the table gets printed 3 times. As a result, we get the following:
Pay attention that we printed the same number of columns in every row. If this rule is violated, then we will get
an unpredictable result.
In this example, the middle row and middle column of the table were printed 3 times. And as a result, we get the
following:
We will create the ManualBuild event handler, which will be doing the following:
get the data source, defined in the report;
initialize it (fill it with data);
print the table's rows as many times as there are rows in the data source.
Here is the code of the handler:
When printing, the matrix fills up the values and grows up and down. The result can be as follows:
In the figure, we see a matrix with 2 rows and 4 columns. Here a, b - row header, 1, 2, 3, 4 - column header, a1...a4,
b1...b4 - cells. In order to build such a report, only one data source will be needed, which has got 3 columns and
contains the following data:
a 1 a1
a 2 a2
a 3 a3
a 4 a4
b 1 b1
b 2 b2
b 3 b3
b 4 b4
As seen, the first column represents the matrix row, the second - matrix column, and the third - contents of the cells
at the intersection of rows and columns with the indicated number. When creating a report, FastReport creates a
matrix in the memory and fills it with data. During this, the matrix dynamically increases, if the row or column with
the given number doesn't exist yet.
A header can have more than one level. Let us look at the following example:
In this example, a column is compound, that is, it has got two values. This report requires the following data:
a 10 1 a10.1
a 10 2 a10.2
a 20 1 a20.1
a 20 2 a20.2
b 10 1 b10.1
b 10 2 b10.2
b 20 1 b20.1
b 20 2 b20.2
www.fast-report.com 184 / 451
Here, the first column represents the row, the second and the third represent the matrix column. The last data
column contains the value of the cell.
The next matrix element - subtotal and grand total, the next figure demonstrates it:
This report is built on the same data used in the previous example. Rows that shown grey in the figure, are
calculated automatically.
Matrix can be configured with the help of the mouse. To do this, drag and drop data source columns from the
"Data" window onto the matrix, to create rows, columns and cells. The matrix highlights a red frame to a place
where the new data will be placed:
If the matrix contains some elements already, then when placing a new element, an indicator will be shown. In the
given case, the new data will be placed between the "Year" and "Name" elements:
You can also change the order of the existing elements. To do this, click on the element's border (shown with black)
and drag it to the needed place:
To delete an element, select it with the mouse, and press the "Delete" key.
By default, data in the matrix header is sorted in ascending order. You can change the order of sorting, by selecting
the "Sort" item.
Ordinarily, every item in the matrix header has a total (this is a cell with a "Total" text). You can delete the total,
selecting it and pressing the "Delete" key. In order to enable total again, select an element to which it belongs, and
choose the "Total" item in its context menu.
The "Start New Page" menu item tells the matrix to insert page breaks after printing each header value. For
example, if you enable page breaks for the "Year" item (as shown in the picture above), every year value will be
printed on its own page.
The "Suppress Totals" item allows to suppress totals in case when the group (on which the total value is calculated)
contains only one value.
Function Description
By default, the Sum function is used. You can change this by selecting a cell and choosing the "Function" item in its
context menu:
Choose the "None" function, if you don't intend to print the total in the given cell.
In a matrix, there can be one or several data cells. In case the matrix has several cells, they can be arranged side-by-
side or on top of each other. The "CellsSideBySide" property of the matrix controls how the cells are arranged. It can
be changed from the context menu of the "Matrix" object. You can also choose the arrangement order when adding
the second cell in the matrix. When doing this, look at the red indicator which shows where the second value will be
placed:
After you have added the second value, the rest of the values will be added in the chosen order.
You can use styles in order to change the appearance of the whole matrix. To do this, invoke the context menu of
the "Matrix" object and choose the style:
Do not put "Matrix" object on bands which will be printed on every new page - "Page header", "Page footer",
etc. The matrix in this case will be created every time when the band will be printed, which will lead to stack
overflow.
Most examples will be using the "MatrixDemo" table, which is bundled with the FastReport package. This table
contains the following data:
Run the report and you will see the following result:
In order to set the data formatting, select the whole cell area, as shown in the figure below, and set format by
selecting the "Format..." item in the context menu:
Run the report and you will have the following result:
in the "Property" window press the button and double click "BeforePrint" event;
FastReport will add an empty event handler in the report script. Write the following code:
When you run the report, you will have the following result:
Choose red text color for the condition. A prepared report will be as follows:
As seen, total values are not highlighted. This occurred, because we chose highlight condition for only one cell. To
highlight the rest of the values, it is needed to set up the highlight for all matrix cells.
In this example we used conditional highlight which depends on cell value itself. Besides, you can highlight a cell
depending on values from matrix headers. We will show by the following example, how to highlight cells, which are
belongs to 2000 year, in red. For this, select matrix cells as shown in the figure below:
(int)Matrix1.RowValues[0] == 2000
In this case "Matrix1" is a name of our matrix. The "RowValues" property of the matrix has got an "object[]" type
and contains an array of values from the row header of the current printed row. Number of values in array is equal
to number of levels in a header. There are two values in our example, the first one is "Year" and the second one is
"Month".
www.fast-report.com 197 / 451
Do not highlight the last row. "RowValues" property has an undetermined value for it and will cause an error
when building the report.
You can also use matrix's "ColumnValues" property for column values reference.
Matrix1.RowIndex % 2 != 0
and choose background color a little darker than the previous one. In this example "Matrix1" is a name of our
matrix. The "RowIndex" property of the matrix returns the number of the current printed line.
For column highlighting, use the matrix "ColumnIndex" property in the same way.
If your matrix has expressions instead of data field, you have to check that the matrix "DataSource" property
was set up correctly. When working with data columns, this property is filled automatically when you drag a
column onto a matrix.
Let us consider an example on how to use expressions. For this, we will use the "Order Details" table as a data
source, which contains a list of sold products, grouped by employees. There are several relations in this table, which
gives an access to the name of an employee, product name and its category.
Our matrix will show each employee's sales, categorized by products. In order to build the matrix, do the following:
add the "Order Details.Products.Categories.CategoryName" data column to the column header;
add any item to the row header in order to create a matrix element. Then set the following expression for the
header element:
add any item to data cell in order to create a matrix element. Then set the following expression for the cell:
Why did we indicate such a long data column as a name of an employee though we could get a name from the
"Employees.FirstName"? We did that because the matrix is connected to "Order Details" data source. Using
relations between this data source and other tables, it is easy to refer to its columns (more details about
relations can be read in the "Data" chapter). If we refer directly to the "Employees.FirstName" data column, we
will get a name of the first employee in a table.
Set up the matrix appearance. After that it will look as the follows:
When we run the report, we will see quite a big matrix which occupies 2 sheets:
Order Details.Orders.Employees.Photo
select the cell containing the category name and increase its size;
add the "Picture" object to this cell;
in order to show a category picture, bind the "Picture" object to the following data column (this can be done
in the object editor):
Order Details.Products.Categories.Picture
Now let us add three "Shape" objects to the cell with "Revenue" value.These objects will serve as indicators in the
following way:
if value in a cell is less than 100, only one object of red color will be shown;
if value in a cell is less than 3000, two objects of yellow color will be shown;
if value in a cell is more or equal to 3000, three objects of green color will be shown.
Now the matrix looks like this:
To control objects, we will use an event handler for a matrix cell. For this, select the "Revenue" cell, and create the
"BeforePrint" event handler using the "Properties" window. Write the following code in the handler:
1 2 3 ...
1 1
2 2
3 3
... ...
Do the following:
add an empty matrix into the report;
put any element from the "Data" window into the row, column and cell of the matrix. Then call expression
editor by double clicking the matrix element and clear an expression;
clear the "DataSource" property of the matrix.
These steps are required to create a "dummy" matrix which has one row, column and cell. As a result the matrix will
be as follows:
Now create a "ManualBuild" event handler. For that, select the matrix, go "Properties" window and press the
button. Double click the "ManualBuild" event and FastReport will create an empty event handler. Write the
following code in it:
In a handler, you should use the "AddValue" method of the "Matrix" object in order to fill it with data. This method
has three parameters each of which is an array of System.Object type. The first parameter is a column value, the
second one is the row value, and the third one is the cell value. Note that the number of values in every array
should comply with the object's settings! In our case an object has one level in column, row and cell,
correspondingly we supply one value for columns, one for rows and one for cells.
When we run the report, we will see the following:
Let us demonstrate how to add a value "21" to the matrix, at the intersection of column 7 and row 3. For that,
change a code in the following way:
Corner
The cells located in the corner of the matrix can contain arbitrary information. You can also split/combine them as
you like.
Header
Matrix header can contain two types of elements:
simple element: displays static information such as the text "Total".
group: displays a list of values grouped by a specific criterion.
The header has a tree structure. The root element is invisible, it contains visible first-level elements.
Any arrangement of elements is allowed; for example, a header may not have a group, or it may have several
adjacent groups. The totals can also be arranged in an arbitrary way.
In design mode, the matrix displays visual cues in the header area:
Column header
- "Year" group
- "Month" group
- "Total" element
Data area
Cells in a data area usually contain an aggregate function. See section Data Area Setup.
The matrix must be connected to the data source — the DataSource property is responsible for this. Typically,
this property is set up automatically during the header and cell setup.
Context menu
To open the context menu, select any element of the matrix, then right-click on the area in the upper left corner of
the matrix:
DataRowPriority Rows The priority of headers when accessing database fields from data cells. See
section Properties available from data cells.
EvenStylePriority Rows The priority of the number of rows or columns to enable EvenStyle property.
ResetDataOnRun False Reset data every time you run a report. By default, the matrix is not rebuilt
during interactive operations (see section Interactive Options).
WrappedGap 0 The gap between the parts of the matrix in the mode Layout = Wrapped.
using the header context menu. Select the element next to which you want to add a new element and select
one of the "Add a new element" commands from the context menu. An empty new element will be added;
you can also add a "Total" element (before or after the selected element) using the context menu. A new
element will be added with the text "Total" (the text depends on the current localization).
Adding a total is equivalent to adding an empty item and editing its text.
When you add a database field from the "Data" window to an empty matrix, its DataSource property is
automatically configured.
Removing an element
You can delete an element by selecting the "Delete" item in the context menu. You can delete only the selected
element, or the element tree (the selected element and all its children).
You can also delete an element by pressing the Delete key. In this case, only the selected element is deleted.
An element with a lock icon cannot be deleted in the described way. See section TopN Grouping.
Moving an element
To move an element to a new location, select it with the left mouse button. The element will be marked with a thick
black frame:
Grab the element by the frame and move it to a new location. As you drag, it will show in which part of the header
a new element will be added:
Release the mouse button and the element will be moved to a new location:
www.fast-report.com 214 / 451
If the element has children, they will be moved with the main element, if it is possible.
Editing elements
To call the element editor, double-click on it with the left mouse button, or select the "Edit ..." in the context menu.
You can also call the editor by pressing Enter.
You can turn a simple element into a group and vice versa. Some of the settings in the editor window are not
available for a simple element.
The group allows you to display a list of values grouped by condition. In the example above, the condition
[MatrixDemo.Year] is specified — this means that the element will display a list of years. The list will contain non-
duplicate values; identical values will be grouped.
By default, the group displays the values specified in the grouping condition. For example, if the condition
[MatrixDemo.Month] is specified, the month numbers will be displayed. The "Display Text" property allows you to
display a different value, for example:
[MonthName([MatrixDemo.Month])]
[Matrix1.RowNo]. [MatrixDemo.Name]
Description of settings:
"Sort order" — sets the sort order — ascending, descending or no sort.
"Sort by" — select one of two sort options: by displayed values, or by total value. The pictures below show how the
"Year" element is sorted:
By element value:
By total value:
"Interactive sort by total" - defines how to sort the header values if interactive sort is active (see Interactive sort).
The options are None, Auto, and the name of the total.
"Sort order toggled by button" — here the name of the button of type MatrixSortButton is specified, which is
located in the corner of the matrix or outside of it. When you click the button in the report viewer, the sort order is
changed and the matrix is updated.
[MatrixDemo.Year] == 2015
In the second case, the values of a specific element in the header are filtered. Unlike the previous option, the result
can contain empty values:
How it works
TopN function uses four elements to display data:
1. TopN group is a source group containing a large number of values.
2. TopN total, which displays a total of TopN values.
3. Group "Others", which displays values that are not included in TopN.
4. The result of the group "Others".
If the source group has fewer values than specified in the TopN.Count property, it is displayed as usual, without
TopN grouping. Otherwise, the following happens:
N values are left in the main group;
the rest of the values are transferred to the "Others" group;
data in the main group and in the "Others" group are aggregated;
the obtained values are displayed as a total of TopN and as a total of the group "Others".
Setup
TopN is set up for the main group. To do this, double-click on the element or select "Edit ..." from the context menu.
In this case, the main group is highlighted in red, and additional elements are marked with a lock icon. You can
delete them in the main element editor window by unticking "Create additional items" checkbox.
The "Stepped layout" option toggles the layout of nested elements between block (default) and stepped layout.
Let's look at the example of a matrix with a nested row header (Year, Month). The block layout looks like this:
If you enable the "Stepped layout" option for the "Year" element, the arrangement of the elements will change as
follows:
This option can be used for any element that has nested elements.
The "Page Break" option inserts a new page before printing the element. No new page is inserted before the first
element.
The option "Merge with a single subitem" is used in the case of dynamically collapsed headers (see section
Collapsing/expanding elements). The option allows you to hide the "Total" element. Below is the view of the
finished report with the disabled option (by default).
and with enabled, pay attention to the output of the "Year" element:
"Column span" and "Row span" options allow you to merge cells in columns and rows when element is printed. By
default, the element controls these parameters automatically.
[Matrix1.RowNo]
These properties can be used in the "Displayed Text" field of a header cell, for example:
[Matrix1.RowNo]. [MatrixDemo.Name]
1. Andrew Fuller
When you add an element to an empty matrix, its Property DataSource is automatically configured.
When adding a new item, its title will also be added next to the existing one:
Removing an element
You can clear the text of an element by сhoosing Delete or "Clear" from the item menu. The data element itself
cannot be deleted; for this, you should delete the corresponding element in the matrix header. In the example
above, you must remove the element "Revenue" from the header in order to delete "[Sum(Revenue)]".
Editing an item
To edit the text of an element, double click to call the text editor window. You can also call the editor by pressing the
Enter key.
You can quickly select a DB field displayed in an element using the (smarttag) speed button, which is displayed
when the mouse cursor is inside the element:
You can also perform the following operations using the context menu of an element:
call the element editor;
customize data formatting;
change type of aggregate function (see section Aggregate functions);
add interest calculation;
insert a progress indicator or sparkline into the cell.
[Function(Expression)]
Square brackets are used to specify expressions in cell text. You can use multiple aggregate functions in one cell
along with regular text.
[Sum([MatrixDemo.Revenue])]
Function Description
ValuesList Returns a list of all values found in a cell. This aggregate is used to work together with the "Diagram" and
"Sparkline" objects.
object _FuncName(List<dynamic> l)
GrandColumnTotal
Returns the value of the grand total for the column.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
GrandColumnTotal(Sum([MatrixDemo.Revenue]))
Sum([MatrixDemo.Revenue]) / GrandColumnTotal()
GrandRowTotal
Returns the value of the grand total for a row.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
GrandRowTotal(Sum([MatrixDemo.Revenue]))
Sum([MatrixDemo.Revenue]) / GrandRowTotal()
GrandTotal
Returns the value of the grand total.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
GrandTotal(Sum([MatrixDemo.Revenue]))
Sum([MatrixDemo.Revenue]) / GrandTotal()
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
ColumnTotal(Sum([MatrixDemo.Revenue]))
Sum([MatrixDemo.Revenue]) / ColumnTotal()
RowTotal
Returns the value of the row total for the current group.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
RowTotal(Sum([MatrixDemo.Revenue]))
Sum([MatrixDemo.Revenue]) / RowTotal()
ColumnMaxValue
Returns the maximum value of the column total for the current group.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
ColumnMaxValue(Sum([MatrixDemo.Revenue]))
Sum([MatrixDemo.Revenue]) / ColumnMaxValue()
ColumnMinValue
Returns the minimum value of the column total for the current group.
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
ColumnMinValue(Sum([MatrixDemo.Revenue]))
Sum([MatrixDemo.Revenue]) / ColumnMinValue()
RowMaxValue
Returns the maximum value of the row total for the current group.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
RowMaxValue(Sum([MatrixDemo.Revenue]))
Sum([MatrixDemo.Revenue]) / RowMaxValue()
RowMinValue
Returns the minimum value of the row total for the current group.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
RowMinValue(Sum([MatrixDemo.Revenue]))
Sum([MatrixDemo.Revenue]) / RowMinValue()
FirstColumn
Returns the value of the first cell in the column.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed .
FirstColumn(Sum([MatrixDemo.Revenue]))
FirstColumn(Sum([MatrixDemo.Revenue]), true)
Sum([MatrixDemo.Revenue]) / FirstColumn()
FirstRow
Returns the value of the first cell in a row.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed.
FirstRow(Sum([MatrixDemo.Revenue]))
FirstRow(Sum([MatrixDemo.Revenue]), true)
Sum([MatrixDemo.Revenue]) / FirstRow()
LastColumn
Returns the value of the last cell in the column.
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed.
LastColumn(Sum([MatrixDemo.Revenue]))
LastColumn(Sum([MatrixDemo.Revenue]), true)
Sum([MatrixDemo.Revenue]) / LastColumn()
LastRow
Returns the value of the last cell in a row.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed.
LastRow(Sum([MatrixDemo.Revenue]))
LastRow(Sum([MatrixDemo.Revenue]), true)
Sum([MatrixDemo.Revenue]) / LastRow()
PreviousColumn
Returns the value of the previous cell in the column.
www.fast-report.com 233 / 451
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed.
PreviousColumn(Sum([MatrixDemo.Revenue]))
PreviousColumn(Sum([MatrixDemo.Revenue]), true)
Sum([MatrixDemo.Revenue]) / PreviousColumn()
PreviousRow
Returns the value of the previous cell in a row.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed.
PreviousRow(Sum([MatrixDemo.Revenue]))
PreviousRow(Sum([MatrixDemo.Revenue]), true)
Sum([MatrixDemo.Revenue]) / PreviousRow()
NextColumn
Returns the value of the next cell in the column.
www.fast-report.com 234 / 451
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed.
NextColumn(Sum([MatrixDemo.Revenue]))
NextColumn(Sum([MatrixDemo.Revenue]), true)
Sum([MatrixDemo.Revenue]) / NextColumn()
NextRow
Returns the value of the next cell in a row.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed.
NextRow(Sum([MatrixDemo.Revenue]))
NextRow(Sum([MatrixDemo.Revenue]), true)
Sum([MatrixDemo.Revenue]) / NextRow()
SpecificColumn
Returns the value of the cell with the specified column index.
www.fast-report.com 235 / 451
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
SpecificRow
Returns the value of the cell with the specified index in a row.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
PercentOfColumnTotal
Returns the value of the current cell divided by the value of the column total.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Function call
Examples:
PercentOfColumnTotal(Sum([MatrixDemo.Revenue]))
[Sum([MatrixDemo.Revenue])] [PercentOfColumnTotal()]
PercentOfRowTotal
Returns the value of the current cell divided by the value of the row total.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
PercentOfRowTotal(Sum([MatrixDemo.Revenue]))
[Sum([MatrixDemo.Revenue])] [PercentOfRowTotal()]
PercentOfGrandTotal
Returns the value of the current cell divided by the value of the grand total.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been accessed in the
cell.
Examples:
PercentOfGrandTotal(Sum([MatrixDemo.Revenue]))
[Sum([MatrixDemo.Revenue])] [PercentOfGrandTotal()]
PercentOfPreviousColumn
Returns the value of the current cell divided by the value of the previous cell in the column.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed .
PercentOfPreviousColumn(Sum([MatrixDemo.Revenue]))
PercentOfPreviousColumn(Sum([MatrixDemo.Revenue]), true)
[Sum([MatrixDemo.Revenue])] [PercentOfPreviousColumn()]
PercentOfPreviousRow
Returns the value of the current cell divided by the value of the previous cell in a row.
Parameter Description
aggregate (optional) Aggregate function. Parameter can be omitted if the aggregate has already been
accessed in the cell.
useInteractiveSort=false (optional) Include the results of interactive sort, in which the order of the elements can be
changed .
PercentOfPreviousRow(Sum([MatrixDemo.Revenue]))
PercentOfPreviousRow(Sum([MatrixDemo.Revenue]), true)
[Sum([MatrixDemo.Revenue])] [PercentOfPreviousRow()]
[Matrix1.RowIndex]
These properties can be useful for highlighting cells with color based on a condition.
You can also access data source fields from a cell. As a rule, this is required to enable conditional highlighting (see
section Conditional highlighting). Thus, for a data cell, you can specify the following condition to highlight values
related to 2012:
[MatrixDemo.Year] == 2012
The value of the DB field that was used to print the cell is taken from the matrix header. Since there are two
headings (row and column), you must specify which heading values will have priority. Matrix property
DataRowPriority is responsible for this. The property is set to Rows by default.
When you click on a button in the preview window, related elements are hidden or shown. In this case, the report is
rebuilt:
Adding a button
You can add a button to a header element using the context menu. Select the item, right-click and select Collapse
button. The button is added to the left side of the element.
When a button is added, the element's Property Padding.Left changes so that the button does not overlap the
text.
Button customization
When a button is added, FastReport automatically configures the link between the button and its managed
element. In some cases, you may need to configure the link manually. To do this, open the editor of the element
that should be dependent on the button, and specify the name of the button on the "Visibility/Visibility is toggled
by" tab.
The initial state of the controlled element — its visibility — is set in the element editor on the "Visibility/Visible" tab.
Deleting a button
www.fast-report.com 241 / 451
You can delete a button in two ways:
select the button and press the Delete key;
uncheck the "Collapse button" in the context menu of the element.
Moving a button
By default, the button has Property Dock = Left. This means that it is docked to the left edge of the element. Set
Property Dock = None in the "Properties" window to move the button to a new place.
You can also use the Property Anchor of a button to anchor it to a specific location of an element.
Default
Property value Description
Exportable False If True, the button will be displayed when exporting the report.
Printable False If True, the button will be displayed when printing a report.
ShowCollapseExpandMenu False Determines whether a menu with "Collapse/Expand All" items should be
shown when the right mouse button is pressed on this button.
When you click on the button in the preview window, the opposite header is sorted. The example below sorts rows
by value in the selected column:
Each press of the button switches the sort mode: ascending/descending/no sort.
Adding a button
You can add a button to a header element using the context menu. Select the element, right-click and select "Sort
Button". The button will be added to the right part of the element.
When you add a button, the element's Property Padding.Right changes so that the button does not overlap the
text.
Button customization
The header sort mode is set in its editor on the "Sort/Interactive Sort" by Total tab. The following values are
possible:
"No" - this header is not sorted.
"Auto" is the default mode. Sort is performed by the value of the first total (aggregate).
Total (aggregate) name: if the header has several output values, you can select one of them to sort. In the
example below, to sort the row header by the ItemsSold value, select the Sum ([MatrixDemo.ItemsSold])
aggregate:
Removing a button
There are two ways to remove a button:
select the button and press the Delete key;
uncheck the "Sort button" item in the context menu of the element.
-
www.fast report.com 243 / 451
Moving a button
By default, the button has Property Dock = Right. This means that it is docked to the right edge of the element. To
move the button to a new location, set Property Dock = None in the Properties window.
You can also use the Property Anchor of a button to anchor it to a specific location on an element.
AllowInactiveSort True Determines whether the button can be in an inactive state ("no sort" mode).
Exportable False If True, the button will be displayed when exporting the report.
Printable False If True, the button will be displayed when printing a report.
Choose the type of hyperlink by selecting the tab in the left side of the window. After you have done, you may click
the "Modify the object's appearance..." checkbox at the bottom of the window. The appearance of the object will
change in the following way:
blue color will be set for the text and it will underlined;
a hand cursor form will be set.
In some cases hyperlink needs to be shown in the preview window, but there is no need to print it. This is easy to
do, if you disable the "Printable" object property. This can be done in the "Properties" window.
When clicking on the link of this type, the System.Diagnostics.Process.Start method is executed with the link's
value as a parameter.
You can indicate the value of the link by using two methods:
indicate the value directly, for example, "http://www.fast-report.com";
indicate an expression, which returns the value of the link. This expression will be calculated when you run the
report.
"MyBookmark"
indicate an expression, which returns the name of the bookmark. For example, you can use a data column as
an expression. The value of the expression will be calculated when the report is run.
After the bookmark has been defined, you can indicate its name in the hyperlink configurations window. This can
be done by using two methods:
indicate the name of the bookmark directly;
indicate an expression which returns the name of the bookmark. For example, this can be a data column. This
expression will be calculated when the report is run.
When you choose a report page, its "Visible" property resets to false. This means that, when the main report
will be built, this page will be skipped.
This control shows a tree structure, which was formed during the report building. If you click the tree element, you
will navigate to the corresponding report element.
If the report has got an outline, it will be shown automatically. You can show or hide the outline by clicking the
button on the toolbar. The report does not create an outline automatically - you should take care about this.
The report page and all its bands have the "OutlineExpression" property. To fill the outline, indicate an expression
which returns the element's text in this property. This expression will be calculated when printing a band, and its
value will be added to the outline. If your report is of master-detail or group type, the structure of the outline will be
similar to the report's structure.
The "OutlineExpression" property can be set in the "Properties" window.
Here are the recommendations on how to configure the outline for different types of reports:
if you want to show the sheets of a prepared report in the outline, set the "OutlineExpression" property of the
report page. The expression will return the number of the page:
[PageN]
in the "Simple list" report type with one "Data" band, set the "OutlineExpression" property of that band. As an
expression, use any data column which is printed in the band;
in the master-detail report type with two "Data" bands, set the "OutlineExpression" property of the
corresponding bands. For example, in the "Category/Product" report type, the "OutlineExpression" for the first
band will contain the name of the category, for the second - product's name;
in the group report, configure the "OutlineExpression" property of the group header and a "Data" band. As an
expression for the group header, use the grouping condition. For the "Data" band, use any data column which
is printed in the band.
Right click on the object and select the "Hyperlink..." item in the context menu. Configure the link in the following
way:
After this, enable the "Modify the object's appearance..." checkbox, in order to apply some link attributes (blue text
color, underlining and a hand-like cursor) to the object.
Run the report and click on the object. The web-browser window opens, and you will move to the FastReport home
page.
Create the parameter which will be used to pass a selected category from the main report to the detailed one. For
category identification, we will use the "CategoryID" column which is contained in both "Categories" and "Products"
tables. Configure the parameter in the following way:
Now we need to set data filtering to filter all products that belong to the specified category. To do this, double click
the "Data" band. Switch to the "Filter" tab and indicate the following condition:
Right click on the "Text" object and select the "Hyperlink..." menu item. Set up the link in the following way:
As a report name, choose the name of the detailed report file. Report parameter can be chosen from the drop-
down list, by pressing the button on the right side of the list. As a parameter value, indicate the "
[Categories.CategoryID]" expression.
Run the report, and you will see the categories list:
As seen on the picture, the title of the tab is set to the hyperlink's value. In our case, this is the numeric value
contained in the "CategoryID" data column. This appears not informative and not beautiful. Let's change our report
to use the category name instead of its number. For this, do the following:
In the detail report:
change the parameter's "DataType" property to the "String";
add the "Categories" data source into the report. It will be used for referring to the "CategoryName" column
when filtering data;
change the filtering expression of the "Data" band:
[Products.Categories.CategoryName] == [SelectedCategory]
While we are working with this example, we have created two reports and swap between them several times. This
is not very comfortable. In order to make the task easier, two reports can be placed into one: the main report will be
on the first page, the detail one on the second page. In this case the hyperlink needs to be set in the following way:
In the given case, we need to choose Page2 as the detail report page.
As seen, the value of a cell is the sum of employee's sales for the whole year. Let us create a detailed report which
will be displayed when we click the cell. In our case the detailed report can contain the sales of a selected employee
for every month of a selected year.
How to connect a cell with data, on which basis it was printed? Each cell of the matrix has got its own address. This
is a combination of the values from the column and row headers. In our example, the address of the cell is a
combination of the year and name of the employee. Exactly this data can be passed to the detailed report. How can
this be done? Very simple: set the hyperlink, showing only the report name and name of the parameter. Parameter
values do not need to be indicated: for a matrix cell, FastReport itself forms the value and passes it into the
parameter.
Assuming that, we have clicked on the top left cell, containing the number 3900. This is the sum of the sales of the
employee named "Andrew Fuller" for the year 1999. What form is used to pass this value into the parameter?
FastReport combines column and row values, by using a separator:
1999;Andrew Fuller
Does it mean that we must extract the value of the year and the name of the employee from this string, convert the
year into the int, and use these values for data filtering? No, it's much simpler. All that we need to do is to create a
parameter that has nested parameters. You can learn about this in the "Data" chapter. In the given case, parent
parameter can be like this:
FastReport passes the values into the SelectedCell.Year and SelectedCell.Name nested parameters. These values
will be converted into data types, indicated in the parameter configuration - this is why it is important to configure
parameter data types correctly.
Detailed report is placed on a separate page of the main report and uses the same data source:
In order to show the sales of a chosen employee for a chosen year, set up the filtering. For this, open the "Data"
band editor and indicate the following filtering condition:
The report is ready. Run it for execution and click on the top left cell. A detailed report will be opened, having the
following data:
The report will use the "Categories" and "Products" tables. In the TOC, we will print the categories list. The rest of
report will print the categorized list of products. Report template will be made up of two pages: the first page will
be used to print the TOC; the second one is the main part of the report.
We will discuss the TOC firstly. Create a new report and add "Categories" and "Products" data sources into it.
Connect the "Data" band to the "Categories" table and place the objects in the following way:
In order to make the TOC objects interactive, configure its "Hyperlink" property:
[Engine.GetBookmarkPage([Categories.CategoryName])]
On the second page of the report, we will create a master-detail report as shown in the figure below:
Set up the bookmark we navigate to when clicking on an element in the TOC. For this, select the first "Data" band
and indicate the following expression in its "Bookmark" property:
[Categories.CategoryName]
"Contents"
[Categories.CategoryName]
[Products.ProductName]
You will be asked to select a base report file. That file must be created at this moment. After that, the base report
will be loaded into the designer. You can change it as you want. You see that objects from the base report are
marked with the "lock" sign:
That means, you cannot delete such objects, rename it or move to another band.
You can add new objects or bands, change the object's appearance, size and location. When you have done, save
the report.
<inherited Name="Text1"/>
If we change the object's location in the inherited report, it will be saved like this:
When opening the inherited report, FastReport will load all object's properties, defined in the base report, plus
properties, saved in the inherited report.
One chart may have one or several chart areas. One chart area may contain one or several series. Below you can
see the chart which contains two chart areas (the first area contains two series, the second area contains one
series):
Some series (for example, pie series) require exclusive chart area.
To add a new series, press the "Add..." button. You will see the "Gallery" dialog:
Select the needed category, then - needed series type. If you want to place the series in its own chart area, check the
"Add new chart area for this series" checkbox. For some series types (such as pie, circular, financial, pyramidal) the
new chart area is added automatically regardless of this checkbox state.
To delete the series, press the "Delete" button. To change series order, use "Up" and "Down" buttons.
if necessary, set the data filter expression. This filter will be applied to all chart series;
select the series in the series list;
switch to the "Data" tab;
choose data columns for each series value. Depending on series type, it may have two or more values. Most
series types have two values - X value and Y value:
if necessary, set the data filter expression. This filter will be applied to current series only;
in the "Color" control, you may indicate a data column which returns a color value.
You may also provide list of values for the series. In this case, the data connection is not needed. To do this, select a
series in the series list and switch to the "Values" tab. Fill the table with values:
You can choose one of the sort modes - do not sort, sort by X value, and sort by Y value.
...
If we try to build a chart based on this data (for example, employee's sales - set X value to Name column, Y value to
ItemsSold column), we will get the following wrong result:
In this situation, we need to group the same employees into one value. To do this, select the series in the series list,
and switch to the "Data processing" tab. Select the group type - "X value" and choose "Sum" as group function:
As a result, all identical employees will be grouped into one value, their sales will be summarized. You will see the
following result:
Algorithm Description
TopN Only top N values are displayed. All other values are collected and displayed as "others" value (you can
choose the label for this value).
BottomN Bottom N values are displayed. If the text for the collected value is not set, this value is not displayed.
Less than value Series values less than specified value, are collected and displayed as "others" value.
Less than Series values less than specified percent, are collected and displayed as "others" value.
percent
Greater than Series values greater than specified value, are collected and displayed as "others" value.
value
Greater than Series values greater than specified percent, are collected and displayed as "others" value.
percent
For example, to display top 5 values, set up the series in the following way:
You can use one of the following explode types: biggest value, lowest value and specific value. If you choose the
latter mode, you have to specify a value which you want to explode. It may be any expression (see the "Expressions"
chapter for details). For example, if you need to explode Andrew Fuller's value, use the following expression:
"Andrew Fuller"
on the "Data processing" tab, check the "Group by X value" checkbox. It is necessary because our data source
has several employees with the same name;
select the chart in the series list and set up its auto-series column on the "Data" tab:
our series may have different number of values (because some employees do not have sales in this particular
year). To align series values, check the "Align X values" checkbox.
We will get the following result:
switch to the "Data processing" tab and select the group type - "X value":
open the data band editor and indicate the following filter condition:
[MatrixDemo.Name] == [SelectedEmployee]
If you click the value, you will see the following detailed report:
One "Map" object can display one or more layers. Each layer contains its own map.
To add a new layer, click on the "Add..." button, which opens the following dialog:
Large map files (more than 30Mb) or map files containing a lot of polygons (more than 20,000) slow down
report generation.
Set the border color and style of the map polygons and choose the color palette. Note that the palette is ignored if
you configure the color scale (more about this later).
If the "ESRI shapefile" layer type is chosen set the field name which contains the displayed information. As a rule,
it's a "NAME" field. The world map included in the FastReport demo program contains the following fields:
NAME (eg: Germany)
ABBREV (eg: Ger.)
ISO_A2 (eg: DE)
ISO_A3 (eg: DEU)
Other maps will have a different set of fields.
If the "application geodata" layer type is chosen set the minimum zoom value for displaying the labels. The default
value is 1, meaning the labels are always displayed.
The color scale consists of several ranges. Each range has the following properties: min value, max value and color.
You can use as many ranges as you need. To set up the color scale set the number of ranges first and then the
properties for each range.
By default all range properties are set to "Auto", meaning FastReport calculates the minimum and maximum values
for each range automatically. The auto color is chosen from three presets ("Start color", "Middle color", "End color").
The "Auto" mode may be suitable in most cases.
When a color scale is set up, an indicator control is displayed in the bottom part of the "Map" object:
The size ranges have the following properties: min value, max value and size (in pixels). You can use as many
ranges as you need. Set the number of ranges first and then set the properties for each range.
By default all range properties are set to "Auto", meaning FastReport calculates the minimum and maximum values
for each range automatically. The auto size is chosen from two presets ("Start size", "End size"). The "Auto" mode
may be suitable in most cases.
The "Data" window allows to operate with all data elements and also to drag them into the report page. All
operations can be done with the help of the toolbar and "Action" menu:
A part of these operations is duplicated in a context menu of the "Data" window. For example, if you select a data
source, you can use its context menu to create a calculated column, delete a data source, or view its data.
All data registered in a report is listed in this window. Just tick off those data which are needed in your report. It can
be done at any moment while working with a report.
The second method - you create a new data source yourself. It can be a DB table or a SQL query. In such a case,
data source definition is saved in a report file.
FastReport allows connecting to many popular DBMS (data base management systems) such as MS SQL, Oracle,
Interbase, Access. Besides this, you can use data files which are saved in xml/xsd format.
DB table content is not saved in a report file. Instead, the connection string and the data source schema are
stored. A connection string can contain such data as login and password, that is why it is kept ciphered in a
report file. When needed, you may increase the safety by using own key for data ciphering. In this case a report
file can be opened correctly only in your program.
First of all, you are offered to create the connection. For that, press the "New connection..." button. You will see a
window with connection settings:
Press the "Next" button to continue. Here you will be offered to choose tables which are accessible in the data base:
Tick off the needed tables and close the wizard by pressing the "Finish" button. Now you can see in the "Data"
window a connection created by you which contains the chosen data sources:
JSON connector
When creating a new connection in the FastReport designer, it looks like this:
Setting Description
Encoding Sets the encoding in which the request for JSON will be processed, if a link to receive it is provided.
JSON or URL Sets static JSON or a link to receive JSON via API.
Headers Sets the required HTTP headers for connecting to JSON via the API (optional).
On the right side there are buttons for editing the field in a separate window.
If the JSON Schema value is empty, then when you click OK or Test connection, a schema will be automatically built
using JSON.
If you change JSON or URL when the schema is already specified, FastReport will offer to update the schema.
Then there is the editor field where you can change the JSON text.
The "Word Wrap" checkbox will enable or disable word wrapping in the editor.
Field Description
item Item
You will see the query wizard window. Query wizard has four pages. Use the "Next" and "Back" buttons to switch
between the pages.
In the first step, you need to set the name of a query. This name will appear in the "Data" window. Enter any unique
name and press the "Next" button.
In the second step, you have to enter a query in SQL language. Use the language dialect which is supported by your
MSDB. You can use the query builder for visual query creation. To do this, press the "Query Builder" button. The
query builder will be described in details later.
After you have entered the query text, press the "Next" button. In the third step, you can define the query
parameters. It is required if your query has parameters. We will consider parameters later in this chapter.
On the last step of the wizard, you can set up the columns which were returned by the query:
As a rule, it is enough to be assured that the query has returned all the needed columns. On this step, you can do
the following:
delete unnecessary columns using the "Delete" button;
reset the columns by pressing the "Refresh" button;
add a calculated column by pressing the "Add calculated column" button. For a new column, it is necessary to
set the "Name", "DataType" and "Expression" properties.
After closing the wizard by pressing the "Finish" button, you will return to the "Data wizard" window.
This is the query to MS SQL demonstration database. The parameter with "param1" name is defined in a query.
Here it should be noted: method of describing parameters in a query differs for different DBMS. For MS SQL a
parameter is marked by a "@" symbol, MS Access parameters do not have names and are marked by the "?"
symbol.
If your SQL query contains parameters, you have to declare them. It can be done in the third step of the "Query
Wizard" which we have looked at above. To create a parameter, press the "Add parameter" button. A new
parameter will be created:
Property Description
Name Parameter name. Here you need to indicate the same name which you use in the query text. Some DBMS
(for example, MS Access) do not support named parameters. In this case do not change this property.
DefaultValue Value which will be used if the "Expression" property is not specified, or if it is impossible to calculate it (for
example, when operating with the query in the report design mode).
Expression Expression which returns parameter's value. This expression will be processed when you run the report. You
can indicate any expression in this property (see details in the "Expressions" chapter).
Size Parameter data size. This property should be indicated if the parameter is of "string" data type.
If you set the parameter properties incorrectly, you will get an error when turning to the last page of the wizard.
[MyReportParameter]
report1.SetParameterValue("MyReportParameter", 10);
In the second way, you use the dialogue forms to do this (dialogue forms will be discussed later). For example, if
you need to ask a string-type value, do the following:
add a dialog into your report;
put the "TextBoxControl" on it. This control will be used to enter the string value;
set up the parameter as follows:
Name=param1
DataType=VarChar
DefaultValue= (empty string)
Expression=TextBox1.Text
Size=255
[Categories.Product ID]
When referring to the data element, you must use the alias, if it has been defined. Never refer to an element by
using its original name in this case.
In order to rename a data element in this case, choose it in the "Data" window, and press F2. Also, you can select a
"Rename" item in the object's context menu. After this, enter the required name and press Enter.
You can also rename an element by using the "Properties" window. Select an element in the "Data" window, switch
to the "Properties" window and change the value of the "Alias" property.
In order to delete an alias (reset to the original name), select an element and choose the "Delete alias" item in its
context menu.
This means that, these two data sources are related to each other and can be used in the "master-detail" report
type. You can also use each of these data sources separately in a "simple list" report type.
Both tables have got the CategoryID field, on which the relationship can be set. So, one category may contain
several products.
How can related data sources be used in FastReport? There are two methods of doing this.
First method makes it possible to build reports of "master-detail" type. To do this, two "Data" bands are used. The
master band is connected to the master data source, the detail band - to detail data source. Our example will be like
this:
The second method allows referring to the master from the detail data source. We will show this by an example. Let
us say, we want to print a list of all the products. For this, we need one "Data" band, which is connected to the
"Products" table:
Such a report will print all the products from all the categories. Let us say, beside each product, we want to print a
category name to which it belongs. Without using relation, this would have been harder. All we know about the
product's category is its id (represented by "CategoryID" column in the "Products" table). Category name, which we
would like to print, is stored in the "CategoryName" column of the "Categories" table. With the help of relation, we
can refer to the name of a category in the following way:
[Products.Categories.CategoryName]
For the current row of the "Products" table, FastReport will find the corresponding parent row in the "Categories"
table, and return a value of the "CategoryName" column.
In a general case, way of referring to a parent table field allows an unlimited number of table ancestors:
[Child_table.Its_parent.Parent_of_a_parent.And _so_on.Column_name]
To add such a data column into a report, open the "Products" table in the "Data" window. You will see that among
its columns, there is a link to the "Categories" table:
[Products.Categories.CategoryName]
In the first place, you need to choose the parent and the child tables. After this, in the lower part of the window, you
need to choose related data columns. The tables can be related with the help of one or several data columns. After
the columns have been set, close the relation editor by pressing the Ok button.
The relation that you've created can be seen in the "Data" window, if you choose the child data source and open a
list of its columns. Among the columns, you will see the relationship with the parent source:
Parent source's data column can be inserted onto the report by using the drag&drop method. So, if we choose the
columns shown in the figure, and drag it onto the report page, we will get a "Text" object with the following
contents:
[Products.Categories.CategoryName]
Variable Description
TotalPages Total number of pages in the report. To use this variable, you need to enable the Properties..."
report's double pass. You can do this in "Report menu.
Row# Data row number inside the group. This value is reset at the start of a new group.
AbsRow# Absolute number of data row. This value is never reset at the start of a new group.
Page# Current page number. If you join several prepared reports into one package, this
variable will return current page number in a package.This variable is actually a macro.
It value is substituted when the component is viewed in the preview window. That
means you cannot use it in an expression.
TotalPages# Total number of pages in the report. If you join several prepared reports into one
package, this variable will return the number of pages in a package. You don't need to
use double pass to get the correct value.This variable is actually a macro. It value is
substituted when the component is viewed in the preview window. That means you
cannot use it in an expression.
HierarchyLevel Current level of hierarchy in a hierarchical report (see "Printing hierarchy"). The top level
is equal to 1.
You may use a function in any expression, in the script (see the "Script" chapter), or print its value in the "Text"
object. For example, the following text in the "Text" object:
[Sqrt(4)]
Sqrt(4) + 2
Abs(-2.2) = 2.2
Acos
Function Parameters Return value
Returns the angle (in radians) whose cosine is d. d must be in range between -1 and 1.
Multiply the return value by 180 / Math.PI to convert from radians to degrees.
Example:
Asin
Returns the angle (in radians) whose sine is d. d must be in range between -1 and 1.
Multiply the return value by 180 / Math.PI to convert from radians to degrees.
Example:
Asin(0) = 0
Atan
Function Parameters Return value
Multiply the return value by 180 / Math.PI to convert from radians to degrees.
Example:
Ceiling
Function Parameters Return value
Ceiling(1.7) = 2
Cos
Function Parameters Return value
Example:
Exp
Function Parameters Return value
Exp(1) = 2.71828
Floor
Function Parameters Return value
Floor(1.7) = 1
Log
Function Parameters Return value
Log(2.71828) = 1
Maximum(1,2) = 2
Minimum
Function Parameters Return value
Minimum(1,2) = 1
Round
Function Parameters Return value
Round(1.47) = 1
Round(1.478, 2) = 1.48
Sin
Function Parameters Return value
Returns the sine of the specified angle (d). The angle must be in radians.
Example:
Sqrt
Function Parameters Return value
Tan
Function Parameters Return value
Returns the tangent of the specified angle (d). The angle must be in radians.
Example:
Truncate
Function Parameters Return value
Truncate(1.7) = 1
Asc
Function Parameters Return value
Asc('A') = 65
Chr
Function Parameters Return value
Chr(65) = 'A'
Insert
Function Parameters Return value
Inserts a "value" substring into the "s" string at a specified index position "startIndex" and returns a new string.
Example:
Length("ABC") = 3
LowerCase
Function Parameters Return value
LowerCase("ABC") = "abc"
PadLeft
Function Parameters Return value
Right-aligns the characters in the "s" string, padding with spaces on the left for a total width specified in the
"totalWidth" parameter.
Example:
Right-aligns the characters in the "s" string, padding with "paddingChar" characters on the left for a total width
specified in the "totalWidth" parameter.
Example:
PadRight
Function Parameters Return value
Left-aligns the characters in the "s" string, padding with spaces on the right for a total width specified in the
"totalWidth" parameter.
Example:
Left-aligns the characters in the "s" string, padding with "paddingChar" characters on the right for a total width
specified in the "totalWidth" parameter.
Example:
Remove
Function Parameters Return value
Deletes all the characters from the "s" string beginning at "startIndex" position and continuing through the last
position.
Example:
Remove("ABCD", 3) = "ABC"
Deletes a number of characters specified in the "count" parameter from the "s" string, beginning at a "startIndex"
www.fast-report.com 332 / 451
position.
Example:
Remove("A00BC", 1, 2) = "ABC"
Replace
Function Parameters Return value
Returns a string "s" in which a specified substring "oldValue" has been replaced with another substring "newValue".
Example:
Substring
Function Parameters Return value
Retrieves a substring from the "s" string. The substring starts at a character position specified in the "startIndex"
parameter.
Example:
Substring("ABCDEF", 4) = "EF"
Retrieves a substring from the "s" string. The substring starts at a character position specified in the "startIndex"
parameter and has a length specified in the "length" parameter.
Example:
Substring("ABCDEF", 1, 3) = "BCD"
TitleCase
Trim
Function Parameters Return value
Removes all occurrences of white space characters from the beginning and end of the "s" string.
Example:
UpperCase
Function Parameters Return value
UpperCase("abc") = "ABC"
Adds the specified number of days ("value") to the "date" date and returns a new date.
Example:
AddDays(#7/29/2009#, 1) = #7/30/2009#
AddHours
Function Parameters Return value
Adds the specified number of hours ("value") to the "date" date and returns a new date.
Example:
AddMinutes
Function Parameters Return value
Adds the specified number of minutes ("value") to the "date" date and returns a new date.
Example:
AddMonths
Function Parameters Return value
AddMonths(#7/29/2009#, 1) = #8/29/2009#
AddSeconds
Function Parameters Return value
Adds the specified number of seconds ("value") to the "date" date and returns a new date.
Example:
AddYears
Function Parameters Return value
Adds the specified number of years ("value") to the "date" date and returns a new date.
Example:
AddYears(#7/29/2009#, 1) = #7/29/2010#
DateDiff
Function Parameters Return value
Returns the interval (number of days, hours, minutes, seconds) between two dates.
Example:
DateSerial
Creates a new DateTime value from the specified year, month and day.
Example:
Day
Function Parameters Return value
Gets the day of the month (1-31) represented by the specified date.
Example:
Day(#7/29/2009#) = 29
DayOfWeek
Function Parameters Return value
Gets the localized name of the day of the week represented by the specified date.
Example:
DayOfWeek(#7/29/2009#) = "wednesday"
DayOfYear
Function Parameters Return value
Gets the day of the year (1-365) represented by the specified date.
Example:
DayOfYear(#7/29/2009#) = 210
DaysInMonth(2009, 7) = 31
Hour
Function Parameters Return value
Hour(#7/29/2009 1:30#) = 1
Minute
Function Parameters Return value
Minute(#7/29/2009 1:30#) = 30
Month
Function Parameters Return value
MonthName
Function Parameters Return value
MonthName(1) = "January"
Second
Function Parameters Return value
Second(#7/29/2009 1:30:05#) = 5
Year
Function Parameters Return value
Year(#7/29/2009#) = 2009
Replaces the format item in a specified "format" string with the value of a corresponding Object instance in a
specified "args" array.
For example, the following function call:
contains the following format items: "{0}" and "{1:hh}". They will be replaced with values of myName and
DateTime.Now. The result may look as follows:
{index[,alignment][:formatString]}
index - a zero-based integer that indicates which element in a list of objects to format;
alignment - an optional integer indicating the minimum width of the region to contain the formatted value. If
the length of the formatted value is less than alignment, then the region is padded with spaces. If alignment is
negative, the formatted value is left justified in the region; if alignment is positive, the formatted value is right
justified;
formatString -an optional string of format specifiers.
The following table describes the standard numeric format strings.
Format
Specifier Name Description
D or d Decimal This format is supported for integral types only. The number is converted to a string of decimal
digits (0-9). Format("{0:D}", 10) = "10"
E or e Scientific The number is converted to a string of the form "-d.ddd…E+ddd" or "-d.ddd…e+ddd", where
each 'd' indicates a digit (0-9). Format("{0:E}", 10) = "1,000000E+001"
F or f Fixed-point The number is converted to a string of the form "-ddd.ddd…" where each 'd' indicates a digit
(0-9). Format("{0:F}", 10) = "10.00"
G or g General The number is converted to the most compact notation. Format("{0:G}", 10) = "10"
N or n Number The number is converted to a string of the form "-d,ddd,ddd.ddd…", where each 'd' indicates a
digit (0-9). Format("{0:N}", 1234.56) = "1,234.56"
P or p Percent The number is converted to a string that represents a percent. The converted number is
multiplied by 100 in order to be presented as a percentage.
Format("{0:P}", 0.15) = "15.00%"
X or x Hexadecimal The number is converted to a string of hexadecimal digits. The case of the format specifier
indicates whether to use uppercase or lowercase characters for the hexadecimal digits greater
than 9. For example, use 'X' to produce "ABCDEF", and 'x' to produce "abcdef".
Format("{0:X}", 26) = "1A"
If you format the floating-point values, you may indicate a number of decimal places after the format string:
If the standard numeric format specifiers do not provide the type of formatting you require, you can use custom
format strings:
Format
character Description
0 Zero placeholder. If the value being formatted has a digit in the position where the '0' appears in the format
string, then that digit is copied to the result string. The position of the leftmost '0' before the decimal point and
the rightmost '0' after the decimal point determines the range of digits that are always present in the result
string.
# Digit placeholder. If the value being formatted has a digit in the position where the '#' appears in the format
string, then that digit is copied to the result string. Otherwise, nothing is stored in that position in the result
string.
. Decimal point. The first '.' character in the format string determines the location of the decimal separator in the
formatted value.
, Thousand separator. If the format string contains a ',' character, then the output will have thousand separators
inserted between each group of three digits to the left of the decimal separator.
% Percentage placeholder. The presence of a '%' character in a format string causes a number to be multiplied by
100 before it is formatted.
; Section separator. The ';' character is used to separate sections for positive, negative, and zero numbers in the
format string.
Examples of use:
The following table describes the standard format specifiers for formatting the DateTime values:
f Full date/time pattern (short time) "Sunday, August 09, 2009 2:44 PM"
F Full date/time pattern (long time) "Sunday, August 09, 2009 2:44:01 PM"
The following table describes the custom date/time format specifiers and the results they produce.
Format
Specifier Description
d Displays the current day of the month, measured as a number between 1 and 31, inclusive. If the day is a single
digit only (1-9), then it is displayed as a single digit.
dd Displays the current day of the month, measured as a number between 1 and 31, inclusive. If the day is a single
digit only (1-9), it is formatted with a preceding 0 (01-09).
h Displays the hour in the range 1-12. If the hour is a single digit (1-9), it is displayed as a single digit.
hh Displays the hour in the range 1-12. If the hour is a single digit (1-9), it is formatted with a preceding 0 (01-09).
H Displays the hour in the range 0-23. If the hour is a single digit (1-9), it is displayed as a single digit.
HH Displays the hour in the range 0-23. If the hour is a single digit (1-9), it is formatted with a preceding 0 (01-09).
m Displays the minute in the range 0-59. If the minute is a single digit (0-9), it is displayed as a single digit.
mm Displays the minute in the range 0-59. If the minute is a single digit (0-9), it is formatted with a preceding 0
(01-09).
M Displays the month, measured as a number between 1 and 12, inclusive. If the month is a single digit (1-9), it is
displayed as a single digit.
MM Displays the month, measured as a number between 1 and 12, inclusive. If the month is a single digit (1-9), it is
formatted with a preceding 0 (01-09).
s Displays the seconds in the range 0-59. If the second is a single digit (0-9), it is displayed as a single digit only.
ss Displays the seconds in the range 0-59. If the second is a single digit (0-9), it is formatted with a preceding 0
(01-09).
y Displays the year as a maximum two-digit number. The first two digits of the year are omitted. If the year is a
single digit (1-9), it is displayed as a single digit.
yy Displays the year as a maximum two-digit number. The first two digits of the year are omitted. If the year is a
single digit (1-9), it is formatted with a preceding 0 (01-09).
yyyy Displays the year, including the century. If the year is less than four digits in length, then preceding zeros are
appended as necessary to make the displayed year four digits long.
z Displays the time zone offset for the system's current time zone in whole hours only. The offset is always
displayed with a leading sign (zero is displayed as "+0"), indicating hours ahead of Greenwich mean time (+) or
hours behind Greenwich mean time (-). The range of values is –12 to +13. If the offset is a single digit (0-9), it is
displayed as a single digit with the appropriate leading sign.
zz Displays the time zone offset for the system's current time zone in whole hours only. The offset is always
displayed with a leading or trailing sign (zero is displayed as "+00"), indicating hours ahead of Greenwich mean
time (+) or hours behind Greenwich mean time (-). The range of values is –12 to +13. If the offset is a single
digit (0-9), it is formatted with a preceding 0 (01-09) with the appropriate leading sign.
zzz Displays the time zone offset for the system's current time zone in hours and minutes. The offset is always
displayed with a leading or trailing sign (zero is displayed as "+00:00"), indicating hours ahead of Greenwich
mean time (+) or hours behind Greenwich mean time (-). The range of values is –12:00 to +13:00. If the offset is
a single digit (0-9), it is formatted with a preceding 0 (01-09) with the appropriate leading sign.
: Time separator.
/ Date separator.
FormatCurrency
Function Parameters Return value
Formats the specified value as a currency, using the Windows regional settings.
Example:
FormatCurrency(1.25) = "$1.25"
Formats the specified value as a currency. The "decimalDigits" parameter indicates how many places are displayed
to the right of the decimal.
Example:
FormatCurrency(1.25, 1) = "$1.3"
FormatDateTime
Function Parameters Return value
Formats the specified value as a date/time, using the Windows regional settings. This function does not include
neutral values in the resulting string.
Example:
FormatDateTime(#1/1/2009#) = "01/01/2009"
FormatDateTime(#1/1/2009 1:30#) = "01/01/2009 1:30:00 AM"
FormatDateTime(#1:30#) = "1:30:00 AM"
Formats the specified value as a date/time, using the named format specified in the "format" parameter. The valid
values for this parameter are:
"Long Date"
"Short Date"
"Long Time"
"Short Time"
Example:
FormatNumber
Function Parameters Return value
Formats the specified value as a number, using the Windows regional settings.
Example:
FormatNumber(1234.56) = "1,234.56"
Formats the specified value as a number. The "decimalDigits" parameter indicates how many places are displayed
to the right of the decimal.
Example:
FormatNumber(1234.56, 1) = "1,234.6"
FormatPercent
Formats the specified value as a percent, using the Windows regional settings.
Example:
FormatPercent(0.15) = "15.00%"
Formats the specified value as a percent. The "decimalDigits" parameter indicates how many places are displayed
to the right of the decimal.
Example:
FormatPercent(0.15, 0) = "15%"
ToBoolean(1) = true
ToBoolean(0) = false
ToByte
Function Parameters Return value
ToByte("55") = 55
ToChar
Function Parameters Return value
ToChar(65) = 'A'
ToDateTime
ToDateTime("1/1/2009") = #1/1/2009#
ToDecimal
Function Parameters Return value
ToDecimal(1) = 1m
ToDecimal("1") = 1m
ToDouble
Function Parameters Return value
ToDouble(1) = 1
ToDouble("1") = 1
ToInt32
Function Parameters Return value
ToRoman
Function Parameters Return value
Converts the specified numeric value to its roman representation. The value must be in range 1-3998.
Example:
ToRoman(9) = "IX"
ToSingle
Function Parameters Return value
ToSingle(1m) = 1f
ToSingle("1") = 1f
ToString
Function Parameters Return value
ToString(false) = "False"
ToString(DateTime.Now) = "08/09/2009 4:45:00 PM"
ToWords
Converts the specified currency value to words. The "currencyName" parameter indicates the currency. Valid values
for this parameter are:
"USD"
"EUR"
"GBP"
Example:
Converts the specified integer value to words. The "one" parameter contains the name in singular form; the "many"
parameter contains the name in plural form.
Example:
ToWordsEnGb
Function Parameters Return value
Converts the specified currency value to words in Great Britain english. There are the following differences between
this function and ToWords:
Converts the specified currency value to words in Great Britain english. The "currencyName" parameter indicates
the currency. Valid values for this parameter are:
"USD"
"EUR"
"GBP"
Example:
Converts the specified integer value to words in Great Britain english. The "one" parameter contains the name in
singular form; the "many" parameter contains the name in plural form.
Example:
ToWordsRu
Function Parameters Return value
Converts the specified currency value to words in russian. The "currencyName" parameter indicates the currency.
Valid values for this parameter are:
"RUR"
"UAH"
"USD"
"EUR"
Example:
ToWordsRu object value, bool male, string one, string two, string many string
Converts the specified integer value to words in russian. The "male" parameter indicates the gender of the name.
The "one", "two" and "five" parameters contain a form of the name used with "1", "2" and "5" numbers.
Example:
Returns an element of the "choice" array with the index specified in the "index" parameter. The first array element
has 1 index.
Example:
IIf
Function Parameters Return value
Returns the "truePart" value, if the "expression" is true. Otherwise, returns the "falsePart" value.
Example:
Switch
Function Parameters Return value
The argument supplied to expressions consists of paired expressions and values. The Switch function evaluates the
odd-numbered expressions from lowest to highest index, and returns the even-numbered value associated with the
first expression that evaluates to True.
Example:
Function Description
Let us add total in this report which will be printing the total quantity of units in stock for each category - sum of
"UnitsInStock" data column. Total will be printed in the "Data Footer" band.
To print total value, you need to create it first. For this, press "Action" button in the "Data" window, and choose the
"New total" item. Another method - right click the "Totals" element in data tree and choose "New total" menu item.
You will see the total editor window.
First of all, you will be asked to indicate total's name. You will be referring to the total by its name, so name the
www.fast-report.com 356 / 451
total in such a way that it will be easy to understand as what it calculates. Let us call our total as "TotalUnits".
Then we choose the "Sum" function for the total.
Now we need to indicate data range for which total will be calculated. For that in "Evaluate on each row of the
band:" field, we choose the "Data" band in which a list of products is printed. In the "Print on the band:" field we
choose a band in which total will be printed - that is, the "Data Footer" band.
Close editor by pressing OK button. You will see the new total appears in the "Data" window. Now you can drag it
into the report:
This will mean that, total should be calculated for those products, whose "Discontinued" flag is not set.
Value Description
ReportFinished The object's value will be calculated at the end of the report.
ReportPageFinished The object's value will be calculated when all bands in the page will be finished.
PageFinished The object's value will be calculated at the end of the page.
ColumnFinished The object's value will be calculated at the end of the column.
DataFinished The object's value will be calculated at the end of the data band (when its footer is printed).
GroupFinished The object's value will be calculated at the end of the group (when its footer is printed).
Let's look at how it works. Put the "Text" object which prints the total, on the group header. Set the "ProcessAt"
property of the "Text" object to "GroupFinished":
The delayed print feature will not work if you turn on the report file cache ("Report/Options..." menu, "Use file
cache" checkbox).
Property Description
Name Parameter's name can have any symbols except dot ".".
Expression Expression which returns parameter's value. More details about expressions can be found in the "Expression"
chapter. This expression will be processed when calling a parameter.
Value Parameter value. This property is not available in the designer and can be filled programmatically.
You have to set up "Name" and "DataType" properties. The "Expression" property can be left empty. In this case
parameter's value should be passed programmatically.
Press F2 and give a parameter name, then go to the "Properties" window and set the parameter's "DataType"
property.
Parameters can be nested. To create a nested parameter, select a parent parameter, right-click it and choose the
"New parameter" item in a context menu:
You can refer to both, parent parameter and nested one. Nesting level is not limited.
[Parameter name]
Since a parameter has got a definite type (it is given in the DataType property), then with parameters, you can
perform those actions which are allowed for data type. So, string type parameters can be used in an expression the
following way:
[StringParameter].Substring(0, 2)
Let us see one example of using parameters. Assuming we have a report which prints "Employees" table. We want
to modify the report to print information about an employee with an indicated number. To do this, we need to filter
the data on the "EmployeeID" data column. Create a parameter with "EmployeeID" name. Indicate parameter's type
- Int32, as exactly this type has the "EmployeeID" data column. To filter an employee with an indicated ID we need
to enter "Data" band editor and indicate the following expression in "Filter" tab:
[Employees.EmployeeID] == [EmployeeID]
To pass parameter value from your program to the report, use the following code:
report1.SetParameterValue("EmployeeID", 2);
2 + 2
An expression should be written in a language chosen as a script in a report. By default, it is C#. You can change the
language in the "Report|Options..." menu by choosing the "Script" element in a window.
The expression editor presents a window where you can write an expression and insert some data elements into it:
Text1.Height
For referring to report properties, use Report variable. The following example returns file name from which a report
was loaded.
Report.FileName
Besides, you can refer to nested object properties. The following example will return a report name:
Report.ReportInfo.Name
Math.Max(5, 10)
System.dll
System.Drawing.dll
System.Windows.Forms.dll
System.Data.dll
System.Xml.dll
You have access to all .Net objects declared in these assemblies. If you need to have access to another assembly,
add its name in report assemblies list. You can do it in the "Report|Options..." menu, by choosing the "Script"
element in a window:
For example, if you want to use a function in your report which was declared in your application, add application
assembly (.exe or .dll) in a report assemblies list. After that you can call the function by using namespace of your
application. For example, if the following function is defined in application:
namespace Demo
{
public static class MyFunctions
{
public static string Func1()
{
return "Hello!";
}
}
}
Demo.MyFunctions.Func1()
If you add the "using Demo" line at the top of the report's script, it will allows you to shorten the syntax:
To refer to the function or variable that was defined in a script, just use its name:
myPrivateVariableThatIHaveDeclaredInScript
MyScriptFunction()
You can use in an expression only those functions which return a value.
[Page] + 1
This expression returns next printed page number. A system variable "Page", which returns current report page
number, is used in the expression. It is enclosed in square brackets.
[DataSource.Column]
[Employees.FirstName]
Source name can be compound in case, if we refer to a data source by using a relation. See more details in the
"Data" section. For example, this is how you can refer to a related data source column:
[Products.Categories.CategoryName]
Here it should be noted that: every column has a definite data type, which is set in the "DataType" property (you can
see it in the "Properties" window if to choose data column in the "Data" window beforehand). How a column can be
used in an expression depends on its type. For instance, in above mentioned example, both columns - first name
and last name - have got a string type and that is why they can be used in such a way. In the following example, we
will try to use "Employees.Age" column of numeric type, which will lead to an error:
The error occurs because, you never mix strings with numbers. For this, you need to convert the number into a
string:
In this case, we refer to the "Employees.Age" column as if it is an integer variable. And it is so. We know that all
expressions are compiled. All non-standard things (like referring to data columns) from a compiler's point of view
are converted into another type, which is understandable to a compiler. So, the last expression will be turned into
the following form:
That is, we can use data column in an expressions as if it is a variable having a definite type. For example, the
following expression will return the first symbol of an employee's name:
[Employees.FirstName].Substring(0, 1)
.Net data
Variable type Description
TotalPages int Total number of pages in the report. To use this variable, you need to enable Properties..."
the report's double pass. You can do this in "Report menu.
Row# int Data row number inside the group. This value is reset at the start of a new
group.
AbsRow# int Absolute number of data row. This value is never reset at the start of a new
group.
Every variable has a definite data type. And on this, depends how it will be used in the expression. Here is an
example of an expression where date is being used:
[Date].Year
This expression returns the current year. As "Date" variable has DateTime type, we can refer to its "Year" property.
We can get the current month similarly ([Date].Month).
FastReport converts reference to system variable into the following form (for example, the "Date" variable):
((DateTime)Report.GetVariableValue("Date"))
[TotalSales]
Report.GetTotalValue("TotalSales")
As you can see, the data type is not used here. It is so, because the total value is of FastReport.Variant type. It can be
used directly in any expressions because it is automatically converted to any type. For example:
[TotalSales] * 0.2f
[Parameter1]
Parameters can be nested. In this case, you should use both parent and child parameter names in the following
form:
[ParentParameter.ChildParameter]
Parameters have a definite data type. It is set in the "DataType" property of the parameter. The way it can be used in
an expression depends on parameter's data type.
FastReport converts reference to a report parameter into the following way:
((string)Report.GetParameterValue("Parameter1"))
Script language can be set in the "Report|Options..." menu. This is supposed to be done just after you have created
a new report, because when changing the language, the existing script gets deleted.
Select the event you want and double click it. FastReport adds an empty event handler into the report code:
The "Report" object has got events as well. This object can be chosen by the following method:
select "Report" in the "Report Tree" window;
select "Report" in the drop-down list in the "Properties" window.
In order to delete the event handler, choose an event in the "Properties" window, select the text and press the
Delete key:
In the beginning of the report, the "Report" object fires the StartReport event. Before formation of the report page,
the StartPage event is fired. This event is fired once for every template page (do not confuse with prepared report
page!). In our case, regardless of how many pages were in the prepared report - event is fired once, since the
template report has got one page.
Further, printing of the "Data" band row starts. This happens in the following way:
1. the BeforePrint band event is fired;
2. the BeforePrint event of all objects lying on the band is fired;
3. all objects are filled with data;
4. the AfterData event of all objects lying on the band is fired;
5. the BeforeLayout band event is fired;
6. objects are placed on the band, the height of the band is calculated and band is stretched (if it can);
7. the AfterLayout band event is fired;
8. if the band cannot fit on a free space on the page, a new page is formed;
9. the band and all its objects are displayed on a prepared report page;
10. the AfterPrint band event is fired;
11. the AfterPrint event of all the band objects is fired.
Printing of the band row occurs as long as there is data in the source. After this, the formation of the report in our
case ends. The FinishPage event of a page is fired and finally - the FinishReport event of the "Report" object.
So, by using events of different objects, you can control every step of report formation. The key to correct use of
events - full understanding of the band printing process, expound in the eleven steps above. So, a lot of operations
can be done, by using only the BeforePrint band - any change, done to the object, will also be displayed. But in this
event, it is not possible to analyze, on which page will the band be printed, if it stretches, because the height of the
band will be calculated on step 6. This can be done with the help of the AfterLayout event in step 7 or AfterPrint in
step 10, but in the latter case, the band is already printed and operations with objects do not give out anything. In
one word, you must clearly state, at what moment each event is fired and use, those, which correspond with the
given task.
System.dll
System.Drawing.dll
System.Windows.Forms.dll
System.Data.dll
System.Xml.dll
Apart from that, you can use any object, defined in the FastReport assembly. If you need access to another
assembly, add it to the list of assemblies. This can be done in the "Report|Options..." menu, by choosing the "Script"
tab:
For example, if you want to use a function in your report which was declared in your application, add application
assembly (.exe or .dll) in a report assemblies list. After that you can call the function by using namespace of your
application. For example, if the following function is defined in application:
namespace Demo
{
public static class MyFunctions
{
public static string Func1()
{
return"Hello!";
}
}
}
If you add the "using Demo" line at the top of the report's script, it will allows you to shorten the syntax:
Note that report's native unit of measurement is screen pixels. Keep it in mind when using such object's properties
like Left, Top, Width, and Height. To convert pixels into centimeters and back, use the constants, defined in the
"Units" class:
Method Description
object Calc(string Calculates an expression and returns the value. When calling this method the first
expression)
time, an expression gets compiled, which needs some time.
object GetColumnValue(string Returns the value of the data column. The name must be presented in the
complexName)
"DataSource.Column" form. If the column has got the null value, it is converted into a
value by default (0, empty string, false).
object Returns the value of the data column. Contrary to the previous method, it does not
GetColumnValueNullable(string
complexName)
get converted into a default value and may be null.
Parameter GetParameter(string Returns the reports parameter with the indicated name. Name can be compounded
complexName)
when referring to the nested parameter: "MainParam.NestedParam".
object Returns the value of the report parameter with the indicated name.
GetParameterValue(string
complexName)
void SetParameterValue(string Sets the value of the report parameter with the indicated name.
complexName, object value)
object Returns the value of the system variable, for example, "Date".
GetVariableValue(string
complexName)
object GetTotalValue(string Returns the value of the total, defined in the "Data" window, by its name.
name)
DataSourceBase Returns the data source, defined in the report, by its name.
GetDataSource(string alias)
The Engine object is an engine that controls the report creation. By using the methods and properties of the engine,
you can manage the process of placing bands onto the page. You can use the following properties of the Engine
object:
Property Description
float CurX Current coordinates on the X-axis. This property can be assigned a value, so as to shift the printed
object.
float CurY Current printing position on the Y-axis. To this property, a value can be assigned so as to shift the
printed object.
int CurColumn Number of the current column in a multicolumn report. The first column has the number 0.
int CurPage Number of the page being printed. This value can be received from the "Page" system variable.
float PageWidth Width of the page minus the size of the left and right margins.
float PageHeight Height of the page minus the size of the top and bottom margins.
float Height of the page footer (and all its child bands).
PageFooterHeight
float Height of the column footer (and all of its child bands).
ColumnFooterHeight
bool FirstPass Returns true, if the first (or only) report pass is being executed. Number of passes can be obtained
from the Report.DoublePass property.
bool FinalPass Returns true, if the last (or only) report pass is being executed.
On the figure below, you can see the meaning of some properties listed above.
Engine.PageWidth and Engine.PageHeight properties determine the size of the printing area, which is almost
always less than the actual size of the page. Size of the printed area is determined by the page margins, which is
given by the LeftMargin, TopMargin, RightMargin and BottomMargin page properties.
Engine.FreeSpace property determines the height of the free space on the page. If there is the "Page footer" band
on the page, its height is considered when calculating the FreeSpace. Note that, after printing a band, free space is
reduced.
How does the formation of a prepared report page take place? FastReport engine displays bands on the page until
there is enough space for band output. When there is no free space, the "Report footer" band is printed and a new
empty page is formed. Displaying a band starts from the current position, which is determined by the X and Y
coordinates. This position is retuned by the Engine.CurX and Engine.CurY properties. After printing a band, CurY
automatically increases by the height of the printed band. After forming a new page, the position of the CurY is set
to 0. The position of the CurX changes when printing a multicolumn report.
Engine.CurX and Engine.CurY properties are accessible not only for reading, but also for writing. This means that
you can shift a band manually by using one of the suitable events. Examples of using these properties can be seen
in the "Examples" section.
Method Description
void AddOutline(string Adds an element into the report outline (read the chapter "Interactive reports") and sets the
text)
current position to the added element.
void OutlineRoot() Sets the current position on the root of the outline.
int Returns the page number on which the bookmark with the indicated name is placed.
GetBookmarkPage(string
name)
void StartNewPage() Starts a new page. If the report is multicolumn, a new column is started.
By using the AddOutline, OutlineRoot, OutlineUp methods, you can form the report outline manually. Usually, this
is done automatically with the help of the OutlineExpression property, which every band and report page have got.
The AddOutline method adds a child element to the current outline element, and makes it current. The current
report page and the current position on the page are associated with the new element. If you call the AddOutline
method several times, then you will have the following structure:
Item1
Item2
Item3
For controlling the current element, there are OutlineUp and OutlineRoot methods. The first method moves the
pointer to the element, located on a higher level. So, the script
Engine.AddOutline("Item1");
Engine.AddOutline("Item2");
Engine.AddOutline("Item3");
Engine.OutlineUp();
Engine.AddOutline("Item4");
Item1
Item2
Item3
Item4
Engine.AddOutline("Item1");
Engine.AddOutline("Item2");
Engine.AddOutline("Item3");
Engine.OutlineRoot();
Engine.AddOutline("Item4");
Item1
Item2
Item3
Item4
For working with bookmarks, the AddBookmark and GetBookmarkPage methods of the Engine object are used.
Usually bookmarks are added automatically when using the Bookmark property, which all objects of the report
have got.
By using the Add Bookmark method, you can add a bookmark programmatically. This method creates a bookmark
on the current page at the current printing position.
The GetBookmarkPage method returns the page number on which the bookmark is placed. This method is often
used when creating the table of contents, for displaying page numbers. In this case, the report must have a double
pass.
As seen, you need to indicate the name of the source and its column. The name of the source can be compound in
case, if we are referring to the data source by using a relation. Details about relations can be found in the "Data"
chapter. For example, you can refer to a column of the related data source in this way:
For making the work easier, use the "Data" window. From it you can drag data elements into the script, during this
FastReport automatically creates a code for referring to the element.
For referring to the data source itself, use the GetDataSource method of the Report object:
DataSourceBase ds = Report.GetDataSource("Products");
Help on properties and methods of the DataSourceBase class can be received from the FastReport.Net Class
Reference help system. As a rule, this object is used in the script in the following way:
A list of system variables can be seen in the "Data" window. From it, you can drag a variable into a script, during
this FastReport automatically creates a code for referring to the variable.
A list of totals can be seen in the "Data" window. From it, you can drag a total into the script, during this FastReport
automatically creates a code for referring to the total.
Total value has got the FastReport.Variant type. It can be used directly in any expression, because the
FastReport.Variant type is automatically converted to any type. For example:
Reference to the total value can be done at that time when, it is being processed. Usually the total is "ready to use"
at the moment of printing the band, on which it is located in the report.
Parameters can be nested. In this case, indicate the name of the parent parameter and after the period, the name of
the child parameter:
Report.GetParameterValue("ParentParameter.ChildParameter")
Parameters have got a definite data type. It is given in the DataType property of the parameter. You must take this
into account when referring to parameters. You can see a list of parameters in the "Data" window. From it, you can
drag parameters into the script, during this FastReport automatically creates a code for referring to the parameters.
For changing the value of the parameter, use the SetParameterValue method of the report object:
Report.SetParameterValue("MyParameter", 10);
Select the object, which prints the "UnitPrice" column, and create a BeforePrint event handler:
In order to insert the "Products.UnitPrice" data column into the script, drag it from the "Data" window. During this,
the following string will be added in the script:
((Decimal)Report.GetColumnValue("Products.UnitPrice"))
If we run the report, we will see that all the products, having the price > 20, are highlighted in red:
The same effect can be achieved with the help of the conditional highlighting (you can read more about this in
the "Conditional highlighting" section of the "Report creation" chapter).
The "Row#" system variable returns the number of the row of the printed band. In order to insert into the script a
reference to the variable, drag it from the "Data" window. During this, in the script a string will be inserted:
((Int32)Report.GetVariableValue("Row#"))
If we run the report, we will see that even rows will be highlighted in light-gray color:
The same effect can be achieved with the help of the "EvenStyle" property of the "Data" band. You can read
more about this in the "Highlight odd/even data rows" section of the "Report creation" chapter.
In the given case, the band rows which have the unit price > 20 will be hidden:
The same effect can be achieved by using the data filter which can be set in the "Data" band editor.
In the script, declare the "sum" variable and create a BeforePrint event handler belonging to the band:
The "Products.UnitPrice" data column can be placed into the script, dragging it from the "Data" window.
If you run the report, you will see the following:
For adding a dialogue into a report, press the button on the designer's toolbar. A new dialogue looks as
follows:
CheckedListBoxControl Displays a ListBox in which a check box is displayed to the left of each item.
DataSelectorControl Displays two lists and allows relocating an item from one list to the other.
DateTimePickerControl Represents a Windows control that allows the user to select a date and a time and to
display the date and time with a specified format.
GroupBoxControl Represents a Windows control that displays a frame around a group of controls with an
optional caption.
ListViewControl Represents a Windows list view control, which displays a collection of items that can be
displayed using one of four different views.
MaskedTextBoxControl Uses a mask to distinguish between proper and improper user input.
MonthCalendarControl Represents a Windows control that enables the user to select a date using a visual
monthly calendar display.
NumericUpDownControl Represents a Windows spin box (also known as an up-down control) that displays
numeric values.
RadioButtonControl Enables the user to select a single option from a group of choices when paired with
other RadioButton controls.
All controls, except the DataSelectorControl, are a full analog of the standard Windows.Forms controls. The name of
the element has got a Control suffix, in order to avoid duplicate names. So, the FastReport's ButtonControl
corresponds with the standard Button control.
In fact, the FastReport's control is just a wrapper for the standard .Net control. It wraps many, but not all, properties
of the standard control. If you need some property that is not implemented by the FastReport control, you may
access a wrapped standard control in the following way:
using the "Control" property, which is of System.Windows.Forms.Control type:
using the property which has the same name as the control itself, but without the "Control" suffix. For
example, the TextBoxControl has got the "TextBox" property, which is of System.Windows.Forms.TextBox type
and returns the wrapped TextBox control:
TextBox1.TextBox.ShortcutsEnabled = false;
Help on properties and methods of the controls can be accessed from the MSDN.
For using the data filtering, it is necessary that the initial report contains all the data. The name "filtering" itself,
assumes that, unnecessary data will not be printed when building the report.
The simplest method for organizing data filtering is to use the Filter property on the "Data" band. In the band
editor, you can indicate the filter expression, for example:
By using the dialogue, you can ask a value from a user, and use it in the filtering expression. Look at the "Simple
filter" example in the "Examples" section.
This method can be used, if a simple value is needed. If the task is to display a list of values and inquire one or
several from it, implementing this becomes difficult. You may think that, it is a simple task - showing a list of
employees in the ListBoxControl control element and choosing one or several values. For implementing this, you
need to use the script, which does the following:
get the data source by its name;
initialize data;
fill the ListBoxControl with the data from data source;
after choosing the employee, build a filter expression that will be used in the "Data" band.
FastReport can do this automatically. For this, automatic filtering is used, which we will observe now.
The advantage of this method is that, you can use it in any report without writing any code.
Icon Name
CheckBoxControl
CheckedListBoxControl
ComboBoxControl
DataSelectorControl
DateTimePickerControl
ListBoxControl
MaskedTextBoxControl
MonthCalendarControl
NumericUpDownControl
RadioButtonControl
TextBoxControl
NotEqual <> Filter the value if it is not equal to the control's value.
LessThan < Filter the value if it is less than the control's value.
LessThanOrEqual <= Filter the value if it is less than or equal to the control's value.
GreaterThan > Filter the value if it is greater than the control's value.
GreaterThanOrEqual >= Filter the value if it is greater than or equal to the control's value.
For example, if the "FilterOperation" property of the control is set to "LessThanOrEqual" and you enter the value 5
in the control, then all the data rows will be chosen, for which the corresponding column value is less than or equal
to 5.
For the data of "string" type, you can use extra operations:
Operation Effect
NotContains Filter the value if it does not contain the control's value.
NotStartsWith Filter the value if it does not start with the control's value.
NotEndsWith Filter the value if it does not end with the control's value.
For example, if the "FilterOperation" property of the control is set to "StartsWith" and you enter the "A", then, all
data rows whose corresponding data column's value starts with "A", will be chosen.
The control type depends on the type of the data column. If the column is of string type, then after inserting it, you
will be offered to choose the control type:
If you have inserted two similar controls, connected to the same data column, FastReport automatically configures
the data range with the help of the "FilterOperation" property. The first control will have FilterOperation =
GreaterThanOrEqual, the second - LessThanOrEqual. This will be done in case, if you insert a column which is not of
string type.
As such, for adding data filtering into any report, you need to do the following:
add a new dialogue into the report;
drop onto the dialogue a data column, on which you want to filter the report.
Products.Categories.CategoryName
To create a cascading list, you need to use two data sources with master-detail relation between them (read more
about data sources and relations in the "Data" chapter). Attach the master list to a column in the master data
source; attach the detail list to a column in the detail data source. Also set the master list's "DetailControl" property
to the detail list.
ListBox1.FillData();
The "AutoFilter" property controls the data filtering. It is used by all controls. After the dialogue has been closed by
the "ОК" button, FastReport applies data filter automatically. By default, the property is set to true. If it is disabled,
the filtering will not happen, and you must do it yourself, by calling the "FilterData" method:
ListBox1.FilterData();
On the dialog, place the LabelControl and set its "Text" property in the "Properties" window:
If you run the report, you will see the dialogue. Close it by the "ОК" button, and the report will be built. If the
dialogue is closed by the "Cancel" button or by the "X" button, the report will stop working, and you return to the
designer.
In the given case, the value we have entered is contained in the "Text" property of the TextBoxControl. In order to
print this value in the report, add a new "Text" object on the "Report Title" band and write the following in it:
Now select the CheckBoxControl, open the "Properties" window and click the button. Double click the
"CheckedChanged" event, which is fired when changing the status of the checkbox. FastReport will create an empty
handler for that event. Write the following code in it:
If we run the report, we can enable or disable the TextBoxControl by the checkbox.
We will show how to stop printing products and print just categories, with the help of the dialogue. For this, add a
dialogue into the report:
Double click on the "ОК" button. FastReport creates an empty event handler for the "Click" event. Write the
following code in it:
We will control the visibility of the band, which prints the product's list. In our example, this is a band with a name
"Data2". If the report is run, and the checkbox is unchecked, we will have the following result:
We will show in this example how to filter a products list according to the first letter of the product's name. During
this, we will not use automatic data filtering facilities. For this, add a new dialog into the report and place two
controls onto it - LabelControl and TextBoxControl:
Now open the "Data" band editor and indicate the following filter expression:
Add a new dialogue into the report by pressing the button on the toolbar, and drag the
"Products.Discontinued" column from the "Data" window onto the dialogue form:
This is all we need to do - we did it just by two clicks. FastReport automatically connects the control to the data
column.
Run the report and enable the Discontinued flag. After that, press the "ОК" button, and you will see the report
which contains only products with the Discontinued flag:
Now, in the same way, add one more "Products.UnitPrice" column and correct its header:
That is all we need to do, the rest of the work FastReport has done: connected the controls to the data column and
set up their FilterOperation properties. The first control has got FilterOperation = GreaterThanOrEqual, the second -
LessThanOrEqual.
Run the report and indicate the values, for example from 20 up to 30. When pressing the "ОК" button, a report will
be built. It contains products having values in the indicated range.
[Products.Categories.CategoryName]
Let us add filtering by category name. For this, add a new dialogue and drag the
"Products.Categories.CategoryName" column onto it:
Choose several categories and click the "ОК" button. After this, the data will be filtered and you will see the
following report:
As seen, only products have remained, which are in the chosen category.
Button Description
Page settings.
Watermark settings.
1 Navigate to the indicated page. Enter the page number and press Enter.
Key Description
After editing, close the designer. When doing this, you will be asked to save the changes in the report page.
We will look at the settings accessible in this dialogue. The button "More/Less" allows showing the whole dialogue
or just the basic settings. By default, a dialogue is shown in a simple form.
"Printer" group: here, you can choose the printer, change its settings ("Settings..." button) and choose print to the
file.
"Page" group: here you can choose, which pages to print (all, current or the given page number).
"Copy" group: here you can set the number of copies and choose the order of the pages in the copies ("Collate"):
"Others" group: here you can choose, which pages to print (all, even, odd), choose the order of printing (direct,
reverse), set up the duplex printing (if your printer supports it) and choose the paper source.
"Print mode" group allows choosing one of the printing modes:
Mode Description
The printer prints on a paper, indicated in the report. One report page corresponds with one printed sheet.
Use this mode, if you need to print A3 report on a А4 format paper. One report page will produce two printed
sheets. When using this mode, you have to choose the paper format from the "Print on sheet" list.
Use this mode, if you need to print A4 report having on a А3 format paper. On one printing sheet, you can
print 1, 2, 4 or 8 report pages. When using this mode, you need to choose the format of the paper on which
you want to print, from the "Printing on sheet" list, and also indicate the number of pages in the "Pages on
sheet" list.
After pressing the "Print" button, printing of the report will start. If the "Print to file" flag is chosen, then the name of
the file will be requested and the report will be saved in that file (file with a PRN extension).
Export parameters:
"Compressed" - output file is compressed. It reduces file size but increases export time;
"Embedded fonts" - all fonts used in a report will be included into PDF file. This will significantly increase the
file size;
"Background" - the page watermark will be exported as an image. This will significantly increase the file size;
"Print optimized" - output of all graphics objects (such as pictures, charts) in high resolution for further
printing.
On the "Information" tab, you may fill in the document information fields:
Export parameters:
"Wysiwyg" - the result will be as close to the report as possible. If this option is disabled, FastReport will
reduce the number of rows and columns in the resulting;
"Page breaks" - enables page breaks in the RTF file;
"Pictures" - select the format of pictures in the RTF file. Note that "Metafile" format is best for displaying of
such report objects as MSChartObject and ShapeObject.
Appearance and size of the resulting file depends on the report template (see the "Recommendations on report
development" section).
Export parameters:
"Wysiwyg" - the export result will be as close to the report as possible;
"Pictures" - enables to export pictures;
"Sub-folder" - all extra files are saved in a separate folder called ".files";
"Navigator" - creates a special navigator for navigating on pages;
"Single page" - all pages will be saved in one file.
Appearance and size of the resulting file depends on the report template (see the "Recommendations on report
development" section).
Export parameters:
"Wysiwyg" - the export result will be as close to the report as possible;
"Pictures" - enables to export pictures.
Appearance and size of the resulting file depends on the report template (see the "Recommendations on report
development" section).
Export parameters:
"Wysiwyg" - the result will be as close to the report as possible. If this option is disabled, FastReport will
reduce the number of rows and columns in the resulting file;
"Page breaks" - enables page breaks in the resulting file.
Appearance and size of the resulting file depends on the report template (see the "Recommendations on report
development" section).
Export parameters:
"Wysiwyg" - the result will be as close to the report as possible. If this option is disabled, FastReport will
reduce the number of rows and columns in the resulting file;
"Page breaks" - enables page breaks in the resulting file.
Appearance and size of the resulting file depends on the report template (see the "Recommendations on report
development" section).
Export parameters:
"Pictures" - select the format of pictures in the resulting file.
Export parameters:
"Wysiwyg" - the result will be as close to the report as possible. If this option is disabled, FastReport will
reduce the number of rows and columns in the resulting file;
"Page breaks" - enables page breaks in the resulting file.
Appearance and size of the resulting file depends on the report template (see the "Recommendations on report
development" section).
Export parameters:
"Separator" - the field separator character;
"Codepage" - codepage used to encode the text in resulting file. The "Default" codepage refers to Windows
default codepage. Note that Excel does not support unicode codepages;
"Data only" - enable this checkbox to export objects laying on Data band only.
Export parameters:
"Page breaks" - enables page breaks in the resulting file;
"Empty Lines" - enables empty lines in the resulting file;
"Data only" - enable this checkbox to export objects laying on Data band only;
"Frames" - type of object's borders. Select "None" if you don't want to export borders;
"Codepage" - codepage used to encode the text in resulting file;
"Scale X" - horizontal scale;
"Scale Y"- vertical scale;
"Auto Scale" - calculates scale X and scale Y automatically to avoid data loss.
Export parameters:
"Resolution" - resolution of the graphical image. Use 96dpi for displaying, 300dpi for printing. When
exporting into the TIFF format, you will able to set separate values for horizontal and vertical resolution;
"Jpeg quality" - JPG file compression level. This option is used only when exporting into the Jpeg format;
"Separate file for each page" - if the option is enabled, then each report page will be exported into a separate
file, the name of the file will be formed on the basis of the chosen page with the given number;
"Multi-frame TIFF" - this option produces the multi-frame TIFF file. It is used only when exporting into the TIFF
format;
"Monochrome TIFF" - this option produces the monochrome TIFF file. It is used only when exporting into the
TIFF format.
When exporting several pages into one file (when the "Separate file for each page" option is disabled), the
export will use a lot of CPU/Memory resources.
When all settings have been made click the OK button to save the file to the FTP server.
Enter the "Application Key" (App key) and "Application Secret" (App secret) obtained above. After clicking the "OK"
button FastReport.NET saves these values and uses them again the next time.
The "Save to Dropbox" window has two tabs: File and Proxy:
When all settings have been made click the "OK" button to save the file to the Dropbox.
Enter the "Client ID" and "Client Secret" obtained above. After clicking the "OK" button FastReport.NET saves these
values and uses them again the next time.
The "Save to Google Drive" window has two tabs : File and Proxy:
When all settings have been made click the "OK" button to save the file to Google Drive.
Enter the "Client ID" and "Client Secret" obtained above. After clicking the "OK" button FastReport.NET saves these
values and uses them again the next time.
The "Save to SkyDrive" window has two tabs : File and Proxy:
There is a slight crossing of two objects placed one under another on the same band. The number of records on
report forming was 150. On export to RTF format 450 rows will be created (150 rows for each object and 150 ones
for crossing). If we remove crossing, there will be only 300 rows in the resulting table. In large reports and on huge
number of objects the difference will be really tremendous. That, of course, will affect output file size.
When creating tables in report, pay attention to neighboring cell's borders. It is important that cells do not cross
and arrange in layers. Export filter algorithm will cut off cells but export result may be far from desirable (you will
see not exactly what you wanted to). Arrange objects in such a way that they are placed in line vertically as well as
horizontally. Guidelines can help to perform this.
The grid alignment can also be helpful in case of cells overlapping. Enable grid alignment in designer options. In
order to simplify alignment you can extend grid pitch. Setting of grid pitch and alignment can be found in the
"View|Options..." menu:
Mode Description
SMTP This is default mode. To send an email, you don't need any external programs.
MAPI You may turn on this mode programmatically. To do this, set Config.EmailSettings.UseMAPI = true, or, if you use
EnvironmentSettings component, set its EnvironmentSettings.EmailSettings.UseMAPI property to true.To send an
email, FastReport uses the default email client such as Outlook Express. This client must support the MAPI
protocol.
To send an email, you need to specify a recipient's email address. Also you need to specify the subject and email
body, but this is not required. At the bottom of the dialog, select the format of your report - it will be attached to the
message:
If you use the SMTP mode, you need to set up an account. It is necessary to do only once. Once you have done it,
FastReport will save the parameters in the configuration file. The parameters can be found on the "Account" tab. All
obligatory fields are marked by red asterisk: