I try to format a Date in Jasper Reports and it works with Windows but not with Linux. With Linux the resulting text is truncated.
Code:
JRXML:
<parameter name="timestamp" class="java.util.Date"/>
[...]
<textField>
<reportElement x="0" y="0" width="50" height="16" uuid="0007846a-26f1-457a-a198-67a2f7c8417c">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="local_mesure_unity" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box padding="2"/>
<textElement textAlignment="Left" verticalAlignment="Top">
<font size="8" pdfFontName="Helvetica" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[DATEFORMAT($P{timestamp},"dd.MM HH:mm")]]></textFieldExpression>
</textField>
Maven dependencies:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-functions</artifactId>
<version>5.6.0</version>
</dependency>
Java:
private byte[] createPdf() {
try {
InputStream is = getClass().getResourceAsStream("MyReport.jasper");
JasperReport jasperReport = (JasperReport) JRLoader.loadObject(is);
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("timestamp", new Date());
JRDataSource jrDataSource = new JRBeanCollectionDataSource(new Vector(), false);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, jrDataSource);
byte[] pdf = JasperExportManager.exportReportToPdf(jasperPrint);
return pdf;
} catch (JRException e) {
throw new RuntimeException("Could not create PDF.", e);
}
}
Results:
Result with Windows:
Result with Linux:
PDF properties:
Both generated PDF files have the same font properties in Acrobat Reader for Windows:
As you can see, the font is not embedded. (Second font "Helvetica" disappears if I add dependency jasperreports-fonts and remove attributes pdfFontName, pdfEncodingand isPdfEmbedded).
Research:
I read:
PDF generated with jasperreport not showing well on Linux but yes on Mac, could the os be related?
http://community.jaspersoft.com/questions/527138/pdf-text-truncated-linux-fine-windows
http://community.jaspersoft.com/questions/803503/why-text-filed-value-will-be-truncated-if-application-running-linux
and the solution seems to be to embed the font, but it doesn't work.
I use font "Helvetica" which is one of the default fonts and that's the reason, see Wikipedia:
These fonts, or suitable substitute fonts with the same metrics, must always be available in all PDF readers and so need not be embedded in a PDF
and https://stackoverflow.com/a/27345103/5277820:
If you use these fonts in iText, iText will ignore the embedded parameter, because it is safe to assume that Adobe Reader and other viewers can render these fonts correctly.
Question:
Why have the same font different widths with Windows and Linux? Or why is the text truncating and/or line wrapping different?
To calculate the font-metrics correctly, the font needs to be available to the java virtual macchine.
See this historical question: Font is not available to the JVM with Jasper Reports, that show various solution to the old error launched
However the correct solution with jasper-reports is to use font-extensions
If you use the distributed jasperreports-font.jar it contains these fonts:
DejaVu SansDejaVu SerifDejaVu Sans Mono
You need to use one of these in font name example fontName="DejaVu Sans", there is no automatic mapping to other fonts, the jar physically contains only these .ttf and no other (open jar and verify for different version of jasper-reports).
Hence only font installed on the pc or included in font-extension are available for the JVM.
If you need other fonts, the best solution is to generate your own font-extension including a valid .ttf font this can be done from within the IDE.
Never assume a particular font is available on a client system – gone are the days when there were only a couple of desktop operating systems on the market, available in a handful of western languages, with well-known lists of fonts that were stable for decades.
It's now much easier to create new fonts, users access content in their own language (with language-specific fonts), the industry launches new form factors every few years (with new vanity fonts), Unicode.org releases new specifications (that require overhauling existing fonts) and as a result the actual fonts present on different systems vary widely.
OSX and Windows still function somewhat in the old "fixed font list" mode, but newer entrants don't.
For PDFs, that means you have to embed fonts in the documents.
For the web, that means flexible site design that does not depend on exact pixel letter dimensions.
Trying to use an old legacy font like Helvetica or Arial is a pathologic case: either the client won't have it installed at all, and will alias it to something with different glyph metrics, or it will have an ancient version, that is lacking all the codepoints added since ASCII went out of favour, and won't be able to render modern international text. Arial is a bit more likely to work due to long windows dominance, but that's eroding quickly.
Related
We're using Jaspersoft iReport Designer to create bilingual PDF outputs—each file contains both English and French text.
For accessibility reasons, we'd like to tag each block of text with its appropriate language in the resulting PDF. See PDF19: Specifying the language for a passage or phrase with the Lang entry in PDF documents for what we're trying to do.
Modifying the PDF files manually is not an option since we email them directly to our users.
Does Jaspersoft support this?
No JasperReports version<=6.7.0 do not support this, there is no available property in Configuration Reference to set Lang property to single textElement.
You have 2 options:
Post elaborate the pdf with for example iText as Dave Jarvis suggested. You can either try to change the dictionary or recreate the pdf adding this additional info. These methods are both fairly complex and naturally runtime will increase since you will need to read/recreate the pdf.
Modify source code of JasperReport to add support. Directly modify the JRPdfExporter, JRPdfExporterTagHelper or add your new exporter (to keep original library intact)
In this answer I will show you how you can modify the original lib adding additional tags (adding a LANG entry in the dictionary)
Background
The example in PDF19: Specifying the language for a passage or phrase with the Lang entry in PDF documents, show this PDF Object tree using iText RUPS.
I will assume that it is sufficient to add /Lang in our output related to the specific text that is not in default language of pdf. Note: If you need to add other entry as well the technique remains the same you just need to modify the below code example.
Source code modification
Add a new property net.sf.jasperreports.export.pdf.tag.lang if this
is present on reportElement in a type text field add a /Lang entry
with its value to dictionary.
Modification to JRPdfExporterTagHelper.java
Add static property identifier to follow code style
public static final String PROPERTY_TAG_LANG = JRPdfExporter.PDF_EXPORTER_PROPERTIES_PREFIX + "tag.lang";
Modify startText(boolean isHyperLink) and startText(String text, boolean isHyperlink), only first method is shown in this example (principal is same in second), we need to change method signature adding JRPrintText so that we can retrive properties.
protected void startText(JRPrintText text, boolean isHyperlink)
{
if (isTagged)
{
PdfStructureElement textTag = new PdfStructureElement(tagStack.peek(), isHyperlink ? PdfName.LINK : PdfName.TEXT);
if (text.hasProperties()&&text.getPropertiesMap().containsProperty(PROPERTY_TAG_LANG)){
textTag.put(PdfName.LANG, new PdfString(text.getPropertiesMap().getProperty(PROPERTY_TAG_LANG)));
}
pdfContentByte.beginMarkedContentSequence(textTag);
}
}
Since we change method signature we now need to modify JRPdfExporter.java so that we can recompile
Modify exportText(JRPrintText text)
...
if (glyphRendererAddActualText && textRenderer instanceof PdfGlyphRenderer)
{
tagHelper.startText(text,styledText.getText(), text.getLinkType() != null);
}
else
{
tagHelper.startText(text,text.getLinkType() != null);
}
...
You could remove the boolean text.getLinkType() != null, since we are actually passing the text object now, but I wanted to keep similar code for simplicity of example
Example
jrxml
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="TaggedPdf" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1be2df3d-cbc1-467c-8729-1ed569eb8a0d">
<property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
<property name="net.sf.jasperreports.export.pdf.tag.language" value="EN-US"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="67" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="240" height="30" uuid="0722eadc-3fd6-4c4d-811c-64fbd18e0af5"/>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Hello world]]></text>
</staticText>
<staticText>
<reportElement x="0" y="30" width="240" height="30" uuid="5080190e-e9fd-4df6-b0f6-f1be3c109805">
<property name="net.sf.jasperreports.export.pdf.tag.lang" value="FR"/>
</reportElement>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Bonjour monde]]></text>
</staticText>
</band>
</title>
</jasperReport>
Exported to pdf with modifications above and visualized with iText RUPS
Is this enough according to PDF19: Specifying the language for a passage or phrase with the Lang entry in PDF documents
Verify that the language of a passage, phrase, or word that differs from the language of the surrounding text is correctly specified by a /Lang entry on an enclosing tag or container:
As far as I can see, yes but I'm not an expert in this matter, in any case if you need to add other tags the procedure is the same.
I have a JasperReports jrxml file which has a hyperlink inside a textField element.
I do not want to show this hyperlink in anything other than the HTML view because the link does not work in excel, PDF, word, etc. and does not make sense to show.
I have read the faq with the properties but it just confused me because it does not talk about hiding a textField at all, just "bands" for headers and footers.
Here is the text field I want to hide when not HTML:
<textField hyperlinkType="ReportExecution">
<reportElement style="Report_Param_Value_Link" mode="Opaque" x="400" y="0" width="161" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[Boolean.TRUE.equals($P{LAST_WEEK}) ? "View WTD" : "View last week"]]></textFieldExpression>
<hyperlinkParameter name="noMenu">
<hyperlinkParameterExpression><![CDATA["true"]]></hyperlinkParameterExpression>
</hyperlinkParameter>
<hyperlinkParameter name="reportUnit">
<hyperlinkParameterExpression><![CDATA["repo:/Reports/Operations/Business_Support/Subreports/Business_Support_Performance_Dashboard"]]></hyperlinkParameterExpression>
</hyperlinkParameter>
<hyperlinkParameter name="LAST_WEEK">
<hyperlinkParameterExpression><![CDATA[Boolean.valueOf(!Boolean.TRUE.equals($P{LAST_WEEK})).toString()]]></hyperlinkParameterExpression>
</hyperlinkParameter>
</textField>
Use an Element Key Filter.
The quote from JR Ultimate Guide:
This built-in filter implementations excludes from export elements that match a given element key.
Element keys are set at report design time and are propagated into generated reports.
Each element in a filled report has the same key as the element from the report template that generated it.
To trigger an element key filter, the report designer needs to define one or more report properties that start with <exporter_property_prefix>.exclude.key. Each such property matches a single element key which is to be excluded by the filter. The element key is given by the property value, or if no value is set for the property, by the property suffix.
The following example shows how to specify element keys which are to be excluded from specific export outputs:
<jasperReport ...>
<!-- exclude elements with keys Image1 and Text4 from HTML export-->
<property name="net.sf.jasperreports.export.html.exclude.key.Image1"/>
<property name="net.sf.jasperreports.export.html.exclude.key.Text4"/>
<!-- exclude elements with keys Image5 from PDF export -->
<property name="net.sf.jasperreports.export.pdf.exclude.key.the.image" value=”Image5”/>
...
</jasperReport>
In your case you should add key for text field with hyperlink (for example, textFieldWithHL) and then add one property for each format (pdf, docx, xls, csv, xml, txt, odt) you want to exclude from printing this hyperlink:
<property name="net.sf.jasperreports.export.pdf.exclude.key.textFieldWithHL"/>
<property name="net.sf.jasperreports.export.docx.exclude.key.textFieldWithHL"/>
<property name="net.sf.jasperreports.export.xls.exclude.key.textFieldWithHL"/>
<property name="net.sf.jasperreports.export.csv.exclude.key.textFieldWithHL"/>
<property name="net.sf.jasperreports.export.xml.exclude.key.textFieldWithHL"/>
The expressions from your post:
net.sf.jasperreports.export.{format}.exclude.origin.{suffix}.{arbitrary_name}
net.sf.jasperreports.export.{format}.exclude.origin.keep.first.{suffix}.{arbitrary_name}
allow to exclude the whole bands (also group bands). This filters work with JROrigin objects.
For example, consider a report with a logo that must be included as SVG for PDF output or PNG for HTML output. The JRXML file contains:
<image scaleImage="RetainShape" onErrorType="Blank">
<reportElement key="IMAGE_LOGO_PNG" x="1" y="0" width="100" height="60" uuid="a896cade-f6fc-4d8f-b762-29b950309257"/>
<imageExpression><![CDATA[Transcoder.asPNG($V{V_LOGO_FILE} + ".svg")]]></imageExpression>
</image>
<image scaleImage="RetainShape" onErrorType="Blank">
<reportElement key="IMAGE_LOGO_SVG" x="1" y="0" width="100" height="60" uuid="a896cade-f6fc-4d8f-b762-29b950309257"/>
<imageExpression><![CDATA[Transcoder.asSVG($V{V_LOGO_FILE} + ".svg")]]></imageExpression>
</image>
To exclude the SVG from HTML and the PNG from PDF, add the following properties immediately after the <jasperReport...> root element in the JRXML file:
<property name="net.sf.jasperreports.export.html.exclude.key.IMAGE_LOGO_SVG"/>
<property name="net.sf.jasperreports.export.pdf.exclude.key.IMAGE_LOGO_PNG"/>
Looking at your source, it may be possible to create an ExporterFilter that suppresses hyperlinks, and then you have to add that filter to the export process for everything except HTML. However, I don't see why you don't want to show the hyperlink in the other formats. For many years PDF, Word, Excel, etc. will all interpret a hyperlink correctly, and in fact respond to a mouse click on the link just like a browser. That's probably why the process is going to be painful: you are reversing what for most people is expected behavior.
I am using TIBCO Jaspersoft Studio-6.2.0.final for generating report . I am able to generate report in word (.docx).
I added some sample text. In export word sample text shown inside a frame. But when I am trying to update or add any extra text into that report in word, its hiding inside the frame. When I expand that frame, then it showing.
How I can generate report in word without any frame like normal word? So that I can add any text, so it will show normally.
Below I added jrxml code.
<queryString>
<![CDATA[SELECT 1 FROM DUal]]>
</queryString>
<field name="1" class="java.math.BigDecimal"/>
<detail>
<band height="20" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="1" width="510" height="19" uuid="68ec5b9f-416e-45d6-b2aa-4d1f31a08250">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement>
<font fontName="Arial" size="11"/>
</textElement>
<textFieldExpression><![CDATA["This is the sample text for testing.To test in word"]]></textFieldExpression>
</textField>
</band>
</detail>
Update:
Is any one having any update on this?
Currently there is no possibility to generate paragraph-oriented docx content. The built-in .docx exporter is a grid-layout exporter, so it will generate a table-based document. This is why enclosing frames/table cells are present in the document. Even if you'd use a single huge textfield for your entire document, a table with a single cell will be generated as docx output.
The only way to get the desired behavior is to implement and use a custom paragraph-oriented docx exporter, based on existing JasperReports APIs.
I hope this helps.
Jasper export .docx as grid/table. In your exported document use Layout -> View Gridlines to show those tables. You can edit them manually if it's a single report what you need. Else, check Aspose library or try to implement manually a custom exporter.
If your only problem is that fields doesn't expand when you write, just add this code to your report properties:
<property name="net.sf.jasperreports.export.docx.flexible.row.height" value="true"/>
I have a JasperReports jrxml file which has a hyperlink inside a textField element.
I do not want to show this hyperlink in anything other than the HTML view because the link does not work in excel, PDF, word, etc. and does not make sense to show.
I have read the faq with the properties but it just confused me because it does not talk about hiding a textField at all, just "bands" for headers and footers.
Here is the text field I want to hide when not HTML:
<textField hyperlinkType="ReportExecution">
<reportElement style="Report_Param_Value_Link" mode="Opaque" x="400" y="0" width="161" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[Boolean.TRUE.equals($P{LAST_WEEK}) ? "View WTD" : "View last week"]]></textFieldExpression>
<hyperlinkParameter name="noMenu">
<hyperlinkParameterExpression><![CDATA["true"]]></hyperlinkParameterExpression>
</hyperlinkParameter>
<hyperlinkParameter name="reportUnit">
<hyperlinkParameterExpression><![CDATA["repo:/Reports/Operations/Business_Support/Subreports/Business_Support_Performance_Dashboard"]]></hyperlinkParameterExpression>
</hyperlinkParameter>
<hyperlinkParameter name="LAST_WEEK">
<hyperlinkParameterExpression><![CDATA[Boolean.valueOf(!Boolean.TRUE.equals($P{LAST_WEEK})).toString()]]></hyperlinkParameterExpression>
</hyperlinkParameter>
</textField>
Use an Element Key Filter.
The quote from JR Ultimate Guide:
This built-in filter implementations excludes from export elements that match a given element key.
Element keys are set at report design time and are propagated into generated reports.
Each element in a filled report has the same key as the element from the report template that generated it.
To trigger an element key filter, the report designer needs to define one or more report properties that start with <exporter_property_prefix>.exclude.key. Each such property matches a single element key which is to be excluded by the filter. The element key is given by the property value, or if no value is set for the property, by the property suffix.
The following example shows how to specify element keys which are to be excluded from specific export outputs:
<jasperReport ...>
<!-- exclude elements with keys Image1 and Text4 from HTML export-->
<property name="net.sf.jasperreports.export.html.exclude.key.Image1"/>
<property name="net.sf.jasperreports.export.html.exclude.key.Text4"/>
<!-- exclude elements with keys Image5 from PDF export -->
<property name="net.sf.jasperreports.export.pdf.exclude.key.the.image" value=”Image5”/>
...
</jasperReport>
In your case you should add key for text field with hyperlink (for example, textFieldWithHL) and then add one property for each format (pdf, docx, xls, csv, xml, txt, odt) you want to exclude from printing this hyperlink:
<property name="net.sf.jasperreports.export.pdf.exclude.key.textFieldWithHL"/>
<property name="net.sf.jasperreports.export.docx.exclude.key.textFieldWithHL"/>
<property name="net.sf.jasperreports.export.xls.exclude.key.textFieldWithHL"/>
<property name="net.sf.jasperreports.export.csv.exclude.key.textFieldWithHL"/>
<property name="net.sf.jasperreports.export.xml.exclude.key.textFieldWithHL"/>
The expressions from your post:
net.sf.jasperreports.export.{format}.exclude.origin.{suffix}.{arbitrary_name}
net.sf.jasperreports.export.{format}.exclude.origin.keep.first.{suffix}.{arbitrary_name}
allow to exclude the whole bands (also group bands). This filters work with JROrigin objects.
For example, consider a report with a logo that must be included as SVG for PDF output or PNG for HTML output. The JRXML file contains:
<image scaleImage="RetainShape" onErrorType="Blank">
<reportElement key="IMAGE_LOGO_PNG" x="1" y="0" width="100" height="60" uuid="a896cade-f6fc-4d8f-b762-29b950309257"/>
<imageExpression><![CDATA[Transcoder.asPNG($V{V_LOGO_FILE} + ".svg")]]></imageExpression>
</image>
<image scaleImage="RetainShape" onErrorType="Blank">
<reportElement key="IMAGE_LOGO_SVG" x="1" y="0" width="100" height="60" uuid="a896cade-f6fc-4d8f-b762-29b950309257"/>
<imageExpression><![CDATA[Transcoder.asSVG($V{V_LOGO_FILE} + ".svg")]]></imageExpression>
</image>
To exclude the SVG from HTML and the PNG from PDF, add the following properties immediately after the <jasperReport...> root element in the JRXML file:
<property name="net.sf.jasperreports.export.html.exclude.key.IMAGE_LOGO_SVG"/>
<property name="net.sf.jasperreports.export.pdf.exclude.key.IMAGE_LOGO_PNG"/>
Looking at your source, it may be possible to create an ExporterFilter that suppresses hyperlinks, and then you have to add that filter to the export process for everything except HTML. However, I don't see why you don't want to show the hyperlink in the other formats. For many years PDF, Word, Excel, etc. will all interpret a hyperlink correctly, and in fact respond to a mouse click on the link just like a browser. That's probably why the process is going to be painful: you are reversing what for most people is expected behavior.
I'm working on a system that includes a large number of reports, generated using JasperReports. One of the newer features is that you can define styles for reports.
From the available docs I believe there is some way to have an external file defining styles to use, and you can reference that in your jasper reports. This allows a single style to be used by multiple reports.
I can't find any concrete information on whether this is an actual feature, and if it is, how to use it. Does anyone know if it is possible to have external styles for jasper reports, and if so, how to do it?
Use JasperReport templates. A JasperReports template is one that ends in .jrtx, and may look similar to this (styles.jrtx):
<?xml version="1.0"?>
<!DOCTYPE jasperTemplate
PUBLIC "-//JasperReports//DTD Template//EN"
"http://jasperreports.sourceforge.net/dtds/jaspertemplate.dtd">
<jasperTemplate>
<style name="Report Title" isDefault="false" hAlign="Center" fontSize="24" isBold="true"/>
<style name="Heading 1" isDefault="false" fontSize="18" isBold="true"/>
<style name="Heading 2" isDefault="false" fontSize="14" isBold="true"/>
</jasperTemplate>
and then in your .jrxml file, include it as a template:
...
<template><![CDATA["styles.jrtx"]]></template>
...
iReport also understands this, so your styles are imported and shown in iReport correctly (though I did notice sometimes it wouldn't pick them up an a reload or recompile was necessary).
You can also avoid specifying the actual file name in the <template> element by using a parameter passed into your report at runtime
<parameter name="TEMPLATE_FILE" isForPrompting="false" class="java.lang.String"/>
<template><![CDATA[$P{TEMPLATE_FILE}]]></template>
where $P{TEMPLATE_FILE} is the full path to the style resource
I like to share my learning of using styles in Jasper reports, which I think quite useful for report designers like me, from a book named JasperReport Development cookbook by Bilal Siddiqui. I like this book and found demonstrating styles in a variety of manner like:
Creating a reusable style
Simply select “Style” while creating a new report and define style for text, line and rectangles. The style file will be stored as .jrtx file.
Import reusable style it in your report
There are three chunk of information when importing styles in your report.
Step1. Name and location of style template
<template><![CDATA["C:\\ BigBoldRedTemplate.jrtx"]]></template>
Step2. Each time you apply style to your report elements using the style template, a <reportElement> tag is created as shown below:
//style applied to a rectangle
<rectangle radius="10">
<reportElement style="BigBoldRed" mode="Transparent" x="0" y="0" width="555" height="44"/>
</rectangle>
//style applied to a the text field
<staticText>
<reportElement style="BigBoldRed" x="0" y="0" width="555" height="66"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Monthly Customer Invoices]]></text>
</staticText>
Mixing the internal and reusable styles in report
Using the power of HTML to style your report
For example, your text field has following expression which includes HTML tags (i.e. <li>) and you want the HTML tags to work in your report design:
"<li>"+"Invoice # "+$F{InvoiceID}+", "+
$F{CustomerName}+" purchased
"+$F{ProductName}+" in
"+$F{InvoicePeriod}+" (Invoice value:
\$ "+$F{InvoiceValue}+")"+"
Solution is simple, just set “Markup” property of the text field to “Styled” and that it.
I have taken permission from the author to copy code chunk from his JasperReports cookbook in this post.