Problem: How to make part of string bold in crystal report

Problem: How to make part of string bold in crystal report

I am creating a report in which I have to fetch a string from database and display few words of that string in bold. The condition is that if the “:” (colon) occurs in the string I have to display remaining part normally. All the characters before colon must be displayed in bold. I am not able to find the specific way to do it or find any formula for it.
Does any one have some solution for this. Thanks in advance.

Solution : How to make part of string bold in crystal report

I can think of a few different approaches with this one being the more straight forward.
The approach would be to create 2 formulas to seperate the text, embed both formulas in and then you can bold the first formula.
So create these two formulas:

//@TextLeft
if instr({table.field},”:”) >0
then split({table.field},”:”)[1]
else “”

//@TextRight
if instr({table.field},”:”) >0
then split({table.field},”:”)[2]
else {table.field}

Add a text bos to the report where you want to display the text and size it accordingly.
Drag and embed @TextLeft and then @TextRight into the text box.
Double click the text box to edit it, then right click on @TextLeft formula, choose Format Field, and under Font, change style to Bold.