Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

format the text style in text field iReport

I want to make some text in a text field bold. I visited http://jasperreports.sourceforge.net/sample.reference/markup/index.html but could not get the desired result. I am using text field right now but when I tried using styled/html, the compilation failed. So can you help me with this jrxml code snippet:

<textField>
    <reportElement x="200" y="10" width="590" height="42"/>
    <textElement markup="styled"/>
    <textFieldExpression><![CDATA["The static text without any format.\nThe field's data with bold format<style isBold='true'>:" + $F{TASKS_SUBTASK} + "</style>\n<style isBold='true' isItalic='true' isUnderline='true'>The static underlined text with bold and italic format</style>"]]></textFieldExpression>
</textField>

In this example: Style a text field in Jasper, the text field expression is wrong for which compilation fails.

Your help will be appreciated.

like image 450
Anil Avatar asked Dec 01 '25 08:12

Anil


1 Answers

This work good:

"<style isBold='true' pdfFontName='Helvetica-Bold'>" + $F{data} + "</style>"

for input data from datasource, or

<style isBold="true" pdfFontName="Helvetica-Bold">Bolt text</style>

only for some static text.

For Text-field set properties Markup = styled.

like image 146
Androdos Avatar answered Dec 06 '25 17:12

Androdos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!