Category Archives: Crystal Report Tips and Tricks

Crystal Report Crashed When Opening .rpt file

I am having a problem on my crystal report 11.5. The application that I create cannot load the Crystal Report file, when i try to open a crystal report file(.rpt) that I created a year ago.[which i have edited last week.] 
All of sudden, it just started to crash the Crystal Report application as soon as I open it. 

I have asked my friend to open the same file on his machine and it works… (This .rpt is stored on the network drive). I guess it is something wrong on my computer.
However, i remember that I had silimar issue before, which is caused by the default printer.
Here it is my solution.
  1. Start-> Devices and Printers or [Printers and Faxes]
  2. Select an alternative printer as your default printer.
  3. Try to open up the .rpt again. It should works.
Hope this can help =)

Crystal report PDF font size get reduced/smaller

I just realised the font/text on PDF which I created by using Crystal report get resized. They displays fine on Crystal report preview screen and they were printed ok. When I try to print the same report from the PDF, the print out looks smaller.
After trying to fix it on the Crystal Report(Report option) and Adobe Reader(Print option). I realise that the only the Font get resized and all the Images/Box…etc they are all fine.
Finally, I found out that it is a bug on Crystal Report, it occurs since version 10, (or even eariler).
Here it is the solutions.
You need to modify your computer’s registry in order to fix it.
1) Press “Start” menu and click on “Run” (In Windows XP)
2) Type “regedit” and press Enter to open up Registry Editor
3) On the Registry Editor click on the “+” on “HKEY_CURRENT_USER
4) Then expand “Software”-> “Business Objects”-> “Suite 11.5
5) Click on “Export” and “PDF” if the PDF folder does not exist here
6) Right click on “Export” and Select “New”-> “Key” and rename it as “PDF”
7) After that right click on “PDF” and click on “New”->”DWORD” value and rename it to “ForceLargerFonts
8) Set 1 as the value of “ForceLargerFonts
9) Close Registry Editor and restart Crystal Report application
10) Try to export a PDF and see it the problem has been fixed
Hope this can help.

Enable/Disable Snap to Grid feature on Crystal Report XI

I need to update/Re-Create some Crystal Reports from Crystal Report 8.5 to Crystal report XI [Kind of redo the Report into New version].The most annoying thing is to layout the fields/items properly into the report.
Sometime you may want to drag the field into a specific position or want to make the Textbox, Box/Line slightly bigger or smaller. Even move it little bit upward…etc.
You will find that the Textbox/Box/Line always snapped into the grid.
What you can do is to disable that feature. Then you can drag the fields/controls to wherever you want. = ).
Unfortunately the “Snap To Grid” feature is not placed on the normal place. E.g. “Edit/View” menu… After spending sometime on it, I worked out how to do it.
1) Open up the design screen
2) Right click on the “ruler“.
3) Then you will see a menu appear
Snap To Grid feature Crystal Report
4) You just need to click on the “Snap to Grid” option to make sure it does not have the tick next to it.
5) if you want to enable it again, you can do the process above to enable “Snap to Grid” feature.
Hope you find this useful

Crystal Report Convert Time Format From Seconds to HH:MM:SS

Some of the Crystal report that I need to generate involve conversion between Seconds to Hours:minutes:seconds.
I spend quite a long time to search on internet and work out how to do it and experienced some bugs on one of the Crystal Report formula that I build before had a bug.
I am not sure why it only works on some computer, but not the other.
E.g. it always display 2 decimal places at the end i.e. 1.00. (Although I use Mod to retrieve the reminder of the number, which mean it should not have any decimal place at all)
Anyway, here it is the formula/code that I use to convert Seconds to HH:MM:SS
Hope you find it useful:

numberVar dur;
dur := {Field/Value/Seconds you want to convert};
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

hhmmss := totext(hrs,”00″) + “:” + totext(min,”00″) + “:” + totext(sec,”00″);


Crystal report XI Service Packs 5 solve the PDF font size get reduced/smaller issue

Today I just have a look at the documentation about Crystal report XI Service Packs 5, which has released at the end of Nov 2008.
They have mention the PDF generation issue which I posted few days ago about PDF font size get reduced after you export it from crystal report.

If you have similar issue, the following description may be able to help you get around it.

Hope you find it useful.

The registry key option ForceLargerFonts maintains the correct font size of reports that are exported to PDF format; however,
this option may cause data to be truncated along the right-side margin.
The problem is caused by a mismatch in the way that character widths are calculated between PDF and Microsoft Windows.
New Behavior:
This problem is resolved.
To solve the problem, the PDF export engine has been modified to use an algorithm that positions characters precisely to
prevent truncation, while still maintaining the correct font size. This algorithm is activated and controlled by two new registry
[HKEY_LOCAL_MACHINESOFTWAREBusiness Objects\Crystal ReportsExportPdf]
[HKEY_LOCAL_MACHINESOFTWAREBusiness Objects\Crystal ReportsExportPdf]
The UsePrecisePositioningForText key enables the new functionality when it is set to 1. When this option is enabled, the
ForceLargerFonts option is automatically enabled (to maintain correct font sizes in PDF exports), and any manual settings
made to it are ignored. The TruncationAdjustment key controls a width calculation rounding function in the new algorithm and
accepts values between 0 and 10 inclusively. The default value of 2 has been tested to sufficiently eliminate most truncation
issues. If truncation still happens, users can increase the value.
Known Limitations:
When the UsePrecisePositioningForText key is enabled, exports to PDF format may take slightly longer, but by no more than
10%. Also, the exported PDF document will increase in file size over the standard output, and Crystal reports will consume
more GDI resources during the export.