Requirement:
Making part of the report text bold without using separate text fields.
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>
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
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 accountSign in
Already have an account? Sign in here.
Sign In Now