aleena Posted October 30, 2008 Share Posted October 30, 2008 Hello, I am facing a problem with styled text. My requirement is” I want to display a part of the text as bold “ For e.g. Heavy rain today I am using styled text and enclosed rain with <b> </b> tag. My source is <textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="44" y="23" width="307" height="17" key="textField-1"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement isStyledText="true"> <font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["Heavy <b>rain </b> today"]]></textFieldExpression> </textField> When I execute this report with HTML preview I am getting the result as expected “. Heavy rain today” but when I execute this report with PDF preview I am not getting the bold text and I am getting .” Heavy rain today “. I want to generate PDF as output. So how can I display part of the text as bold in PDF Please help me…. Link to comment Share on other sites More sharing options...
hangman01 Posted October 30, 2008 Share Posted October 30, 2008 The <b></b> tags no longer work on text fields, you need to use <style isBold="true" pdfFontName="Helvetica-Bold">your bold text</style> to make it work. The Helvetica-bold can be replaced with other font names if you are using something different. The quotes must be included and if you are using a text_field and are enclosing the entire text in quotes then an escape character will need to be added before each extra quote such as <style isBold="true" pdfFontName="Helvetica-Bold">. Link to comment Share on other sites More sharing options...
aleena Posted October 30, 2008 Author Share Posted October 30, 2008 Thank you so much....Let me try this one Link to comment Share on other sites More sharing options...
aleena Posted October 30, 2008 Author Share Posted October 30, 2008 That worked... Many thanks Link to comment Share on other sites More sharing options...
jhon.castro Posted June 12, 2015 Share Posted June 12, 2015 for me this work <textField><reportElement uuid="bc2a1059-fa3e-4611-a834-ca5b00a40b48" x="16" y="184" width="522" height="53"/><textElement textAlignment="Justified" markup="styled"><font fontName="Arial" size="9" /></textElement><textFieldExpression><![CDATA["<style isBold="true" pdfFontName="Helvetica-Bold" >De conformidad</style> :]]></textFieldExpression></textField> Link to comment Share on other sites More sharing options...
Recommended Posts
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