CR.NET and Formatting PercentagesI just discovered a new trick for getting Crystal Reports.NET to automatically format a number as a percentage. For example, let's say you have a number 55.99 and you want it to be printed as 55.99%. What I have done in the past is convert the number to a string and concatenate the '%' character to the end. Not bad if you only have to do this to one number, but a pain if you have to do this to more than one field. I was jealous of how Crystal Reports stand-alone version has a '%' button that you click and it formats it automatically. I went into Crystal Reports 10 and analyzed what is happening behind the scenes when you click on the '%' button. I found out that the button tells Crystal Reports that the field is a currency value and it replaces the '$' with a '%'instead. Plus, it tells it to right-align the “currency symbol“. Wow, what a discovery. Here's how to format report fields in Crystal Reports.NET. It looks like a lot of steps, but after you doing it the first time it is a breeze. To format a number as a percentage in CR.NET:
- Right-click on the numeric field and select Format.
- Go to the Number tab and click Customize.
- Click the Currency Symbol tab.
- Click Enable Currency Symbol.
- Change the Currency Symbol to '%'
- Change Position combobox to '-123%'
- Click OK, OK to exit and save.