how to put bold for certain word in textfield?

前端 未结 6 1253
醉酒成梦
醉酒成梦 2021-02-01 21:51

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

相关标签:
6条回答
  • 2021-02-01 22:12

    As an example, one of my expressions: {

    "<b>"+$F{bezeichnung}+"</b>"+" ("+$F{anzahlStimmen}+" "+$R{stimmenI18N}+")"
    

    }

    0 讨论(0)
  • 2021-02-01 22:14

    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>
    

    0 讨论(0)
  • 2021-02-01 22:19

    I just changed Properties → Markup → HTML. It works.

    0 讨论(0)
  • 2021-02-01 22:25

    Try surrounding the words you want to highlight with HTML <b></b> (bold) tags, and change the field content type to HTML

    0 讨论(0)
  • 2021-02-01 22:27

    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.

    0 讨论(0)
  • 2021-02-01 22:27

    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.

    0 讨论(0)
提交回复
热议问题