Jump to content
Changes to the Jaspersoft community edition download ×
  • How to make part of the report text field bold


    Tom C
    • Version: v8.0, v6.3 Product: Jaspersoft® Studio

    Requirement:

    Making part of the report text bold without using separate text fields.

    1(156).png.644a1cabc42a018fe7e9c5178fe8db56.png


    Resolution:

    User can use styled markup to set report field text element, then us style property to wrap around the text to make it bold.

    <textField>
        <reportElement key="" x="0" y="0" width="570" height="30"/>
        <textElement markup="styled"/>
        <textFieldExpression>
            <![CDATA["<style isBold='true'>"+" Who: " + "</style>" + "Who"]]>
        </textFieldExpression>
    </textField>

    2(96).png.0ba5aa54f8eeea0fb48f5e5e2f86d0ad.png

    Here is the sample report template to demonstrate the approach:

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Created with Jaspersoft Studio version 6.3.0.final using JasperReports Library version 6.3.0  -->
    <!-- 2017-03-27T23:34:50 -->
    <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="test_1462146'
                  pageWidth="612"
                  pageHeight="792"
                  columnWidth="555"
                  leftMargin="20"
                  rightMargin="20"
                  topMargin="20"
                  bottomMargin="20"
                  uuid="3472a31c-35f4-4d5d-96fd-2fb1ae932baf">
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
        <queryString>
            <![CDATA[]]>
        </queryString>
        <background>
            <band splitType="Stretch"/>
        </background>
        <title>
            <band height="79" splitType="Stretch">
                <textField>
                    <reportElement key="" x="0" y="0" width="570" height="30" uuid="5036bc88-f2e3-4070-8639-50498dea4325"/>
                    <textElement markup="styled"/>
                    <textFieldExpression>
                        <![CDATA["<style isBold='true'>"+" Who: " + "</style>" + "Who"]]>
                    </textFieldExpression>
                </textField>
            </band>
        </title>
        <pageHeader>
            <band height="35" splitType="Stretch"/>
        </pageHeader>
        <columnHeader>
            <band height="61" splitType="Stretch"/>
        </columnHeader>
        <detail>
            <band height="125" splitType="Stretch"/>
        </detail>
        <columnFooter>
            <band height="45" splitType="Stretch"/>
        </columnFooter>
        <pageFooter>
            <band height="54" splitType="Stretch"/>
        </pageFooter>
        <summary>
            <band height="42" splitType="Stretch"/>
        </summary>
    </jasperReport>

    TTC-20170331-01462146


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...