Monday, May 15, 2006

Getting CR.NET to Automatically Format

bookmark this at :: del.icio.us :: Digg it
I just discovered a new trick for getting CR.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 CR stand-alone version has a '%' button that you click and it formats it automatically.

I went into CR10 and analyzed what is happening behind the scenes when you click on the '%' button. I found out that the button tells CR 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 do it in CR.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.

Hope this helps,

Brian Bischof