The basic building block of a report is the element. An element is a graphical object, such as a text string or a rectangle. In Jaspersoft Studio, the concept of line or paragraph does not exist, as it does in word processing programs. Everything is created by means of elements, which can contain text, create tables, display images, and so on. This approach follows the model used by the majority of report authoring tools.
Jaspersoft Studio relies on the nine basic elements are offered by the JasperReports library:
||Text field (or simply Field)
Through a combination of these elements, it is possible to produce every kind of report. JasperReports also allows developers to implement their own generic elements and custom components for which it is possible to add support in Jaspersoft Studio to create a proper plug-in.
All elements have common properties, such as height, width, position, and the band to which they belong. Other properties are specific to the type of element (for example, font or, in the case of a rectangle, thickness of the border). There are several types; graphic elements are used to create shapes and display images (they are line, rectangle, ellipse, image); text elements are used to print text strings such as labels or fields (they are static text and text field); the frame element is used to group a set of elements and optionally draw a border around them. Subreports, charts, and crosstabs are more complex elements and are discussed later in the this chapter; detail is found in separate chapters. Finally, there is a special element used to insert a fixed-in-place page or column break.
Elements are inserted into bands, and every element is associated inextricably with its band. If an element is not completely contained within its band, the report compiler returns a message about the position of the element; the report is compiled despite this error, and in the worst case, the element simply isn't printed.
This chapter contains the following sections: