Setting text properties

JasperReports provides several ways to control text properties in the report. We can control the font, whether the text is bold, italic, underlined, its background and foreground colors, and so on.

Styles

One way JasperReports allows us to control text properties is by using the<style> element. This element allows us to control the foreground and background colors, the style of font (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.

The following JRXML template illustrates the use of styles:

<?xml version="1.0" encoding="UTF-8" ?> <jasperReport name="ReportStylesDemo" xmlns="http://jasperreports.sourceforge.net/ ...

Get JasperReports 3.5 for Java Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.