Print Page | Close Window

A bold formula

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=5196
Printed Date: 02 May 2024 at 6:43pm


Topic: A bold formula
Posted By: Scrapple
Subject: A bold formula
Date Posted: 13 Jan 2009 at 7:04am
This may not be even possible so I thought I would ask. I have been away from Crystal for awhile and things are still a bit foggy. I have a report with a formula that is empty. In my vb.net code I send a string into this empty formula in my report which then displays this string in the report if the string is not empty. Works fine. Is there a way to set selected words in this string to bold? There are some words and numbers in this string I pass in that the end user wants to set as bold. The end user has no control to change anything in the report. My code generates it and it is displayed for the user to print out and mail.
 
Thanks,
Steve



Replies:
Posted By: DBlank
Date Posted: 13 Jan 2009 at 7:31am
Right click on the field and select Format Field.
Select the Font tab and clcik ont he formula editor next to the Style.
Put your formula here:
if {Field}="condition" then crBold else crRegular


Posted By: Scrapple
Date Posted: 13 Jan 2009 at 7:39am
Thanks for your reply. However, that would bold the entire output of the formula. I am passing the string in from vb.net code and I only want to bold certain words in the string when it shows up on the report, not the entire string. The string I pass in is actually a paragraph in a letter where the user only wants to bold maybe 3 or 4 words in this paragraph.


Posted By: DBlank
Date Posted: 13 Jan 2009 at 7:52am
Sorry, misunderstood your question. I do not know how to assist on this one...
Anyone else?


Posted By: GrisCorp
Date Posted: 18 Sep 2014 at 7:58am
I know this thread is incredibly old, however, I just discovered how to do what the OP requested and thought it may help someone else on here in the future.

In order to bold selected words/fields in a formula you will need to surround them with html tags for bold, <b> </b> , and format the field as HTML.

For example, I have this formula:

if not isnull({PartMast_Ext.SUPMAT_ID})
then
"Part ID:  " + "<b>"+{PartMast_Ext.SUPMAT_ID}+"</b>"


Place the formula in the report then right-click it and select Format Field.  Then select the Paragraph tab and in the Text Interpretation section select HTML Text.

The formula then displays/prints like this:

Part ID: 56134-F

You can also use html tags to, italicize, change the font, the size and/or the color, etc. of the selected words/fields you choose.



Print Page | Close Window