I have for writing essay in the report. I just want to bold some text in my verse. I have put tag in text, but it does not work.
An exam
As an example, one of my expressions: {
"<b>"+$F{bezeichnung}+"</b>"+" ("+$F{anzahlStimmen}+" "+$R{stimmenI18N}+")"
}
For example - first character of the word is RED
<textField pattern="">
<reportElement x="23" y="35" width="189" height="18" forecolor="#000000" uuid="dd8bc5b3-1dc9-4348-84c8-ff7993746830"/>
<textElement textAlignment="Center" verticalAlignment="Middle" markup="styled">
<font fontName="Apolonia" size="17" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["<style forecolor=\"red\">"+$F{L1_word}.substring(0,1)+"</style>"+$F{L1_word}.substring(1)]]></textFieldExpression>
</textField>
I just changed Properties → Markup → HTML. It works.
Try surrounding the words you want to highlight with HTML <b></b>
(bold) tags, and change the field content type to HTML
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.
The <b> </b>
tags no longer work on text fields. Make sure that 'Styled text' is enabled for the text field and put this in the field expression.
<style isBold="true" pdfFontName="Helvetica-Bold">Text to be bold...</style>
The pdfFontName can be whatever you like.
If you are making text bold that is already in a string be sure to escape the above quotes with a backslash or use single quotes.