Crystal Reports Dynamic Text Format

In this article, I describe how to dynamically apply a format to Crystal Reports text. In Crystal Reports, you can't directly change color, font size, style, alignment, etc. So I have created a custom composite control which helps you to format text objects in Crystal Reports.

In Crystal Reports, Text Field object properties like font size, color, style, etc. can't change. For this, I used a HTML editor but it can't support some tags.

So I decided to create my own control which can format the text from client side.

Using the Code

Here, I have used a formula field to show the data in Crystal Reports.

1.gif

In the following image, I show how to add display data in a formula field.

CR2.JPG

In the following image, I show how to add a formula for the font size.

3.gif

In the following image, I show how to add a formula for the font style.

CR4.JPG

In the following image, I show how to add a formula for Text Alignment.

CR5.JPG

In the following image, I show how to add a formula for Font Color.

CR6.JPG

CR7.JPG

Final Demo Project Screenshot

CR8.JPG