9

I want to add bullet point to my static text and to a text field, i added style tag to the jrxml but it didn't work for me :

Here's the example :

TextField :

<textField isBlankWhenNull="true">
    <reportElement uuid="cfd514bc-d1c5-4369-b10d-71042b046e37" x="11" y="0" width="400" height="12"/>
    <textElement/>
    <textFieldExpression><![CDATA[<style size="40">.</style>$F{LMSG}]]></textFieldExpression>
</textField>

StaticText:

<staticText>
    <reportElement uuid="c1485aba-09a4-4c7b-9106-0893341f1368" x="44" y="107" width="309" height="15"/>
    <textElement>
        <font size="9"/>
    </textElement>
    <text><![CDATA[<style size="40">.</style>Je déduis cet avoir de ma commande]]></text>
</staticText>
Alex K
  • 22,315
  • 19
  • 108
  • 236
Amira
  • 3,184
  • 13
  • 60
  • 95
  • Possible duplicate of [Jasper Reports - Bullets and Numbering](http://stackoverflow.com/questions/1643256/jasper-reports-bullets-and-numbering) – Dave Jarvis Jul 08 '16 at 18:39

2 Answers2

13

You can use styled markup.

Try to use <li> tag.

The sample

The jrxml file:

<?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="bullet_sample" language="groovy" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="aa7ced41-689a-4b8d-94aa-ee79c243a7a8">
    <title>
        <band height="79" splitType="Stretch">
            <textField>
                <reportElement uuid="bf39def6-a3a7-4fa1-9e99-e488b3567974" x="159" y="31" width="100" height="20"/>
                <textElement markup="styled"/>
                <textFieldExpression><![CDATA["<li>Text with bullet</li>"]]></textFieldExpression>
            </textField>
        </band>
    </title>
</jasperReport>

The result will be (via preview in iReport):

enter image description here


In case using field, the right expression will be:

<textField>
    <reportElement x="171" y="0" width="100" height="20"/>
    <textElement markup="styled"/>
    <textFieldExpression><![CDATA["<li>" + $F{fieldName} + "</li>"]]></textFieldExpression>
</textField>

Note:

Community
  • 1
  • 1
Alex K
  • 22,315
  • 19
  • 108
  • 236
  • hi thank u , but for the text field it gives an error i use it like this : <![CDATA[
  • $F{LMSG}
  • ]]> – Amira Nov 27 '13 at 11:28
  • @AmiraGL Your expression is wrong. I've just add sample to my answer – Alex K Nov 27 '13 at 11:56