0
votes

I want to know how to change font size in field expression. it's mean I have a two db fields. then now I want to merge those two fields using expression.

example : $F{type1} + " Balance is SLR : " + $F{type2}

I write this simple code in field expression.

but now problem is i want to set 10px font size to $F{type1} field and 12px font size to $F{type2} field.

Thank You

1

1 Answers

1
votes

Use styled text:

<textField>
    <reportElement width="300" y="0" x="0" height="200"/>
    <textElement markup="styled"/>
    <textFieldExpression><![CDATA["<style size=\"10\">" + $F{type1} + "</style> Balance is SLR : <style size=\"12\">" + $F{type2} + "</style>"]]></textFieldExpression>
</textField>

See some details about the feature here.