When the user has
formed conditions
for extracting of
the data set from
the database, he
can proceed to the
next phase –
creating of the
report template
in the MS Excel.
You can begin the
template creation
in several ways:
| 1. |
Use
the item File\Edit
Template
of the main
menu of the
program. |
| 2. |
Click
the button
on the button
panel. |
| 3. |
Use
the item Edit
Template
in the pop-up
menu of the
object tree. |
As
a result of this
operation MS-Excel
will be activated
and a blank workbook
will be added into
it. This workbook
will be used as
a template for the
future report.
Remark
A
new blank
workbook is
added into
the Excel,
because the
property Template
File
is not specified.
In this property
you need to
enter a name
and a full
path to the
Excel workbook,
which is used
as a template.
If the name
of the workbook-template
is specified,
then at calling
«Edit
Template»
this very
workbook will
be opened.
If the template
is located
in the same
folder with
the EXE-file
of the program
XL Report
Builder, it’s
not necessary
to enter the
full path
to the workbook-template.
In the property
Template
File
you can also
enter a relative
path like for
the EXE-file
of the program
(for example
«..\Templates»). |
Let’s
imagine, that the
report must just
show all the records
from the table «Country»
(see example "Quick
Start.xrb"
). For this purpose
the object Query
was created (it
was called «Country»).
To output all the
records from «Country»
it’s necessary
to create a range
that has a special
format in the MS-Excel.
For this you need
to create a table
in the template
(it is shown at
the figure below).
To
output fields from
the database table
into any cells of
the current sheet
it is necessary
to write formulas
like «=Caption_FieldName»,
where «Caption»
means the property
of the object Query
and «FieldName»
means the name of
the field from this
table. In this example
the fields Name,
Capital, Continent,
Range and Population
are used. Then the
formulas will look
like:
«=Country_Name»,
«=Country_Capital»,
«=Country_Continent»,
«=Country_Area»,
«=Country_Population».
These
formulas should
be placed in the
cells «B5:F5».
Here is the full
list of formulas
with the indication
of the cells:
B5
– «=Country_Name»
C5
– «=Country_Capital»
D5
– «=Country_Continent»
E5
– «=Country_Area»
F5
– «=Country_Population».
Don’t
pay attention to
the cell values
(#NAME?), into which
you’ve written
the fields formulas.
Excel just doesn’t
find cells with
such names in the
template. In the
templates of the
reports you can
apply any kind of
formatting to all
cells of the workbook,
insert figures and
change the parameters
of the workbook
itself.
Then
it’s necessary
to tell XL Report
Builder about the
existence of the
range, into which
it is necessary
to put records about
the countries. For
this you should
mark a rectangular
range «A5:F6»
and name it (using
for this the editing
field with the pop-up
list, which is located
to the left from
the formula string).
The word «Range»
is used as a name
at the figure below.
The range can have
any name (as much
informative as it
is necessary). This
range includes one
column on the left
and one row below
more than it is
necessary.
These cells are
used in the XL Report
Builder for the
description of the
additional actions,
which can be done
to the range of
data.
Here
creation of the
report template
can be considered
finished. Having
saved this template
under the definite
name, you can close
Excel.
[
Back
to Table of Contents
]
|