Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Font on a report
PatM
I created a report (no tables, just text). I want to set the font to Calibri, size 11pt.
I have tried the following to no avail:
1) use onCreate event to set the following:
this.getStyle().fontSize = "11pt";
this.getStyle().fontFamily = "Calibri"
2) Create a new Style with that font and size then applying that style to the text
3) Set the report style to that font and size. There is a default report style that came from creating the report.
None of these works, can you assist? How can I set the font and size?
Find more posts tagged with
Comments
kclark
Are you needing to do this from script? If not you can easily do this by selecting the label/text/dynamic text on your report > property editor > general > font.
PatM
Thanks for replying. I am sending the generated report via email but the font doesn't come through in the set format. It's coming through as Courier New yet I set it to Calibri. The size comes through as 10 yet it's set to 11pt.
kclark
Are you exporting the report and sending it? Or just sending the rptdesign? What version of birt are you running and what version is the recipient running? If you're trying to send the rptdesign over email you could export to one of the formats BIRT supports or use tomcat. You would need to download the runtime and deploy the war file in Tomcat. This will let you send a link to your report and it will display in a web browser.
PatM
I am exporting the report, converting it to a byte array output stream then sending it on email. I am running BIRT v4.2.0. I am sending the contents of the report not the rptdesign.
PatM
Picked up something.
On the xml generated, I had the following:
<text id="9">
<property name="fontFamily">"Calibri"</property>
<property name="fontSize">11pt</property>
I added the auto option on the properties palette and it created an extra line:
<property name="contentType">auto</property>
After this, the font works well on the mail content. The only problem is it doesn't pick up the values from my script e.g.
<VALUE-OF>vars["amount"] which it was picking before I added that property. I will work on it a bit more, I think I am closer to getting the solution.
PatM
If this adds value to anyone trying to do the same thing. My content type is HTML so on the text itself, I wanted to maintain a certain format.
This works for the font and size problem I had and comes in the right format on email:
<PRE style="font-size:11pt;font-family:"Calibri";">
.....text
.... text
</PRE>
There could be other ways to do this.