23
iReport Demo Spring 2008 OEDSA Conference

IReport Demo Spring 2008 OEDSA Conference. Report Properties

Embed Size (px)

Citation preview

Page 1: IReport Demo Spring 2008 OEDSA Conference. Report Properties

iReport Demo

Spring 2008 OEDSA Conference

Page 2: IReport Demo Spring 2008 OEDSA Conference. Report Properties

Report Properties

Page 3: 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.

Page 4: IReport Demo Spring 2008 OEDSA Conference. Report Properties
Page 5: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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

Page 6: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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.

Page 7: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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

Page 8: IReport Demo Spring 2008 OEDSA Conference. Report Properties

Creating a new text field

Page 9: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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

Page 10: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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.

Page 11: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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

Page 12: IReport Demo Spring 2008 OEDSA Conference. Report Properties

Formatting Fields

Page 13: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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

Page 14: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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

Page 15: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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

Page 16: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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

Page 17: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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.

Page 18: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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.

Page 19: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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!

Page 20: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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.

Page 21: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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:

Page 22: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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.

Page 23: IReport Demo Spring 2008 OEDSA Conference. Report Properties

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