Jump to content
We've recently updated our Privacy Statement, available here ×

isBold not working in report styles


rwcope2

Recommended Posts

I defined a report style for bold text using the <style> tage like this:

 

Code:

<style
name="HeaderBold"
fontName="sansserif"
isDefault="false"
fontSize="10"
isBold="true"
pdfFontName="Helvetica-Bold"
pdfEncoding="Cp1252"
/>

 

When I print (to printer or screen) the text does not appear in bold. I ran the xmldatasource demo, which does the same thing, and it did not work there either.

 

I do get bold if I add <font isBold="true"/> to the textElement.

 

I'm using JasperReports 1.2.6 on Mac OS X 10.3.9 with Java 1.4.2. Before I report a bug, I wondered if anyone else has seen this?

 

Also, does anyone know a workaround, short of adding bold to every textElement?

 

Thanks,

Rob

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Thanks for the reply. Yes, I'm using it my textElements like so:

 

Code:

<textField isStretchWithOverflow="false" isBlankWhenNull="true">
<reportElement
x="374"
y="72"
width="126"
height="20"
style="HeaderBold"
/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.String">
<![CDATA[$P{pAccountNo}]]>
</textFieldExpression>
</textField>

 

I also see the same problem in the xmldatasource demo, so I'm pretty sure it isn't something I'm doing wrong (although I would be happy to find out it was).

 

Rob

Link to comment
Share on other sites

Lucian,

 

It happened no matter how I viewed it. I used JRViewer, printed to a printer, and printed to PDF, all with the same result.

 

I moved to MacOS 10.4.7 using Java 1.4.2_09 and also saw the problem the first time I tried it. However, after I recompiled the report in this new environment, the problem went away. If I get a chance to try this again on MacOS 10.3.9, I will post the XML export.

 

Thanks again,

Rob

Link to comment
Share on other sites

  • 1 year later...

Was this issue ever resolved? I am currently developing reports with iReport 1.2.8 and isBold is not working properly when i use jasperreports with my application.

 

I cannot format the whole textelement as bold in the font-tag, as it is crucial that only part of the element is bold (that would be the dynamic part of the text element).

 

This is from my JRXML file:

<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="0"

y="0"

width="535"

height="41"

key="textField-5"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" isStyledText="true" lineSpacing="1_1_2">

<font size="9"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["My static text goes here <style isUnderline=true" isBold="true">"+$F{DYN_FIELD1}+"</style> more static text <style isUnderline="true" isBold="true">"+$F{DYN_FIELD2}+"</style> more static text <style isUnderline="true" isBold="true">"+$F{DYN_FIELD3}+"</style&gt]]></textFieldExpression>

</textField>

 

isBold works when i generate the report from iReport -doesn't not work when generated through my application which user the jasperreports libraries.

 

Was this ever resolved?

Link to comment
Share on other sites

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...