Crystal Reports on the web

Looking at the huge number of links, my code snippets and samples that I've accumulated during my journey with Crystal Reports and Report Server (RAS), I've realized that something should be done with all that. So, for all who are struggling with similar problems I've faced while pursuing that elusive goal of putting Crystal Reports on the web, I will put as much information here as I can ...

Wednesday, August 22, 2007


One "interesting" problem with watermark is that will not go over certain objects - such as drawing box... fact that my boxes have background color don't help and I can't find any way to give watermark a priority.
That's really annoying...

Tuesday, August 21, 2007

Pictures in CR XI

I've already mentioned how Crystal handles pictures - poorly :( It does internal conversion of a picture (JPG for instance) into bitmap, increasing the size of the report many times :(
One good thing about Crystal XI is that you can have pictures on the file system instead of embedding them into the report. Put a blank placeholder picture (that has 1-2 Kb) and specify File Location for the real picture. It will shift the job of downloading a picture to the network, but if picture is conditional (think client logos) your report is not several MB long unnecessary ...

Conditional X position change

I had an interesting problem today - to move logo from upper left side to upper right side of the report, conditionally, only for certain companies...
Well, it got interesting when whatever I would enter into formula field next to X coordinate of my picture, got ignored. Nothing will happen, logo will stay at the same place... I've tried one inch, 5 inches, 20 inches... nothing
I've finally found a problem - coordinates on the screen are in inches, but formula is in twips. So great, really.
My changes were too small since one inch has 1440 twips, so I couldn't see any difference in position... As soon as I've entered 12000 logo jumped to the end of the page. Problem solved :)

Here is the text that helped me solved the problem (from Crystal Reports XI User Guide)

To conditionally change the X position of an object
1. Right-click the field that you want to move conditionally, and select Size
and Position.
2. Click the Conditional Formula button next to the X position value field.
3. In the Formula Workshop, enter your conditional X position formula text.
For example, to move orders that were shipped late to a second column,
enter formula text such as this:
If (Orders.Ship Date) < CDateTime (2004, 01, 01, 02, 10,
11) then 4320
Note: The number 4320 represents the new position that you want to
define as the second column. The position is measured in twips; there
are 1440 twips in an inch.
4. Click Save and close to return to your report.
5. Click OK to save your position setting.

Crystal Reports moves objects that meet your condition to a new position, but
leaves those objects that don’t meet the condition where you originally placed