Styles & Templates

Examples focused on report styles and the usage of a jrxml template

HOW-TO add a text watermark

Since DJ 5.0.4 it is possible to add basic text watermark like this     The simplest way to add it is with the DynamicReportBuilder or FastReportBuilder passing only the text (it uses default values) FastReportBuilder drb = new FastReportBuilder(); drb.addColumn(“State”, “state”, String.class.getName(),30) … .addWatermark(“TOP SECRET”) … If you want to pass more parameters such as font, color, […]

HOW-TO Use custom fonts

JasperReports gives the possibility to use custom fonts (like true type fonts) and also embed them to the resulting pdf report. DynamicJasper also allows this feature. Test Description Shows how to create reports using custtom fonts The code example Font font = new Font(28,”Colonna MT”,”/fonts/COLONNA.TTF”, Font.PDF_ENCODING_Identity_H_Unicode_with_horizontal_writing, true); Style titleStyle = new StyleBuilder(false).setFont(font).build(); The constructor […]

HOW-TO Use custom jrxml templates

IMPORTANT: Templates feature has many options, but you need to have this clear: The template must not have groups, DynamicJAsper will create them if necessary. The detail band must be empty: DynamicJasper will work in the detail band, any previously existing element will be deleted. One template per page size and orientation will be needed: […]

HOW-TO Use inherited styles

A great feature of JasperReport is styles inheritance, such feature is supported by DynamicJasper also. A style can have a parent style, for all non defined properties in a style, parents one will be used. In the following example we create a style “subtitleParent” to be used as parent and a “subtitleStyle” to be used […]