ireport demo spring 2008 oedsa conference. report properties
TRANSCRIPT
iReport Demo
Spring 2008 OEDSA Conference
Report Properties
Basic Report Layout
Each section of the report is called a band Different bands will print different sections of the
report Bands can be added, removed and resized Not all bands are always used Fields can be moved, stretched and resized
using the mouse.
List of Bands Used
Title – only prints at top of first page PageHeader – prints at the top of every page Detail – line items – all items print in this section TotalsFooter – created for the Total section to
print right after the last item PageFooter – prints at the bottom of each page
– But not the last page LastPageFooter – prints only on the bottom of
the last page
Modifying Bands
Each band can be resized by dragging the lines up or down
View Bands will allow you to enter a specific width
To remove a band, set the width to 0 To add a band, View Report Groups and click
New. Enter a name and click OK. This will create a new header and footer, with the name specified.
Types of Fields
Static Text – non-data fields, i.e. Headings, titles, labels, etc.
Text fields – can be data and/or non-data Variables – used for calculating of fields Parameters – passed into the report at
compile time – most likely won’t be used
Creating a new text field
New Text Field
View Fields Click New Enter the field name –
this will define it in the report
Select Class Type – String is text fields, BigDecimal for amount fields
New Text Field Cont.
Field Description – the path to this field in the xml
An example of the xml data path is: CompleteReceipt Receipt Item
Item fields are entered with just the field name. Fields above that, in the Receipt or CompleteReceipt, need a ../ or ../../ in front of the name.
Adding a Variable
View Variables, and click New.
Enter a variable name. Choose calculation type,
Add, multiply, etc. Class type and
Expressions should be of BigDecimal type
Formatting Fields
Modifying Fields
Right click on a field and select Properties Print When Expression – can use Java code to
make the field print at certain times. The previous screenshot shows an expression that will print the field when page number isn’t 1.
Top, Left, Width, and Height can be set Foreground and Background colors can also be
set
Modifying field cont.
Fonts Tab Our custom fonts are
available: FT10 = Times New
Roman, size 10 FT8 = Times New
Roman, size 8 FT10B and FT8B are
bold versions
Modifying Fields, cont.
Can set the font yourself, Change both Font name and PDF Font name
Choose size, bold, underline, etc.
Line spacing and alignment can also be set
Modifying Fields, cont.
Static Text – if static text field – enter text here
Text Field – if regular text field, your shown this screen
Can add regular text to the Expression as well as fields
Blank when null if only one field is in the expression
Modifying Fields, cont.
If more than one field is used, java code is needed, shown here. The + “\n” at the end is used for a new line.
Finally, the borders tab will allow a border to be set for the field.
Images
Click the Image button on the toolbar, and drag a box on the form. This is where your picture will go.
Right-click, and select Properties. Graphics Element tab will allow you to add a border.
Image Tab, click Find Browse to the image you
want to add.
Images cont.
Click OK. The picture should appear. It can be moved or resized.
Now, edit the path so USASWeb can see it. Enter the code below.
Remember to copy the images and .jasper files to the server!
Subreports
Most likely won’t be used, but are already on some reports. Subreports are different report files.
This allows a whole other report to be displayed inside a report.
The grayed out areas are sub reports.
Subreports cont.
Parameters are used to send data to the subreport. View Parameters, then click New to add one.
A data source can be applied to a subreport in the report properties as shown here:
Subreports, cont.
Parameters are defined on the Subreport (other) tab.
The subreport Expression field will be the path to the subreport. We pass these in via a parameter.
Additional Resources
The public wiki has a Jasper Reports section available with demos.
http://wiki.ssdt.oecn.k12.oh.us/index.php?title=Jasper_Reports