开发者

Using Crystal reports to generate ID card dynamically

开发者 https://www.devze.com 2023-03-04 18:58 出处:网络
i want to generate an ID card for various group members belonging to different section. Each has a different format depending on what user selects e.g

i want to generate an ID card for various group members belonging to different section. Each has a different format depending on what user selects e.g

Using Crystal reports to generate ID card dynamically

What i also want is the photo portion should be adjustable in the area where the user wants to amd also the ph开发者_JAVA技巧oto that comes from database should be able to crop as per the user requirements.

Is this possible doing using Crystal Reports.Any tutorials and guidelines will be helpful as i am absolutely new to using Crystal Reports. If not using=Crystal Reports,what is the other best option.

Please help me to get the ID card to be generated dynamically.


If you wanted to narrow it down to just one report you could something similar to what MD-Tech suggested but use sections that are hidden or shown depending on the user selection.


There are three options:

  1. two reports - like what MD-Tech is suggesting. two reports, on average, are more difficult to maintain.
  2. one report/two sections - like what BUkHix suggests. you create the desired formatting in two separate sections, then use a parameter to hide/show the desired section
  3. one report/two sub-reports - this gives you the most, finely-grained control over the formatting. the sub-reports display can also be controlled by a parameter.

In any case, you can control the image's X (distance from left margin) in v 11.0 using a conditional formula. In v 12.0, you can also control the Width property with a conditional formula. A conditional formula can reference a parameter field, so the positioning can make use of a user-supplied value.

You will also need to experiment with the image types, as Crystal Reports supports a limited set (JPG and BMP for sure).


Splitting this into 2 answers so much info incoming; firstly loading separate reports:

it is possible to select which reports are loaded at runtime by conditionally calling the Load() function of the document class. An example of this would be (in c++):

ReportDocument myDocument = gcnew myDocument();
if(wideIDcard)
{
   myDocument->Load("wideIDCard.rpt");
}
else
{
   myDocument->Load("narrowIDCard.rpt");
}

where the boolean wideIDCard is set from a dropdown box etc. from a front end. The ReportDocument myDocument can then be sent to the report viewer to view that report.


The quickest way to do this whould be to have 2 separate reports and then have the code Load() the correct one dependent on the user selection, which would come from a separate windows form. It is possible (though difficult) to create this form in such a way as to use it to set all the parameters for the report if you need it to be a single entry form.

0

精彩评论

暂无评论...
验证码 换一张
取 消