Java Reference
In-Depth Information
When there is no data in the report's datasource, by default, JasperReports will not
generate a report. This happens because the default value of whenNoDataType is
NoPages . Setting whenNoDataType to NoPages will result in a report containing zero
pages. If we would like a report displaying all sections, except the detail section, we
can accomplish this by setting whenNoDataType to AllSectionsNoDetail .
Setting Text Properties
JasperReports provides several ways to control the properties of the text in the report
(bold, italic, font, underline, etc.).
One way JasperReports allows us to control text properties, is by using the <style>
element. This element allows us to control the foreground color, background
color, whether the font is bold, italic, or normal, the font size, a border for the font,
and many other attributes. Styles can extend other styles, and add to, or override
properties of the parent style.
Styles were introduced in JasperReports 1.1 and are not
supported by previous versions of JasperReports.
The following JRXML template illustrates the use of styles:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN"
<jasperReport name="ReportStylesDemo">
<style name="parentStyle" isDefault="true" fontName="Times"
isBold="true" fontSize="13" pdfFontName="Helvetica-Bold"/>
<style name="childStyle" fontSize="9"/>
<band height="60">
<reportElement x="0" y="0" width="555" height="35"/>
<![CDATA[This text uses the default report style, in this
report it is called "parentStyle".]]>
Search WWH ::

Custom Search