Skip to Content
Author's profile photo Former Member

How to create a report in Crystal Reports, which can be exported to the respective format correctly?

We have to design a report according to a particular export format viz. PDF, Excel, CSV, etc. A report designed for the PDF format will not be exported correctly to Excel format and vice versa. The below steps will explain how to create a report in Crystal Reports, which can be exported to the respective format correctly.

For this document we will cover PDF, CSV and Excel formats.

Steps of work around:

Step 1: Create an extra parameter in report level which is default parameter @Export_Type and the values as EXCEL, CSV and PDF. Depending on the selected

            parameter value the report will be formatted in the desired format.

Step 2: Design a report as per requirements for PDF format.

Step 3: We will divide each section in the report into 3 parts. The first part will be used to show data fields in PDF format, 2nd part will be used to show data

            fields in Excel format and the 3rd part will be used to show the report in CSV format.

Step 4:  Right click on each section in the report and select “Insert section below”. This will divide each section in a, b, c parts. Ex. Details a, Details b,

                Details c. Refer the snap-shot below:

                s1.JPG

s2.JPG

Step 5: Create a report level static parameter named as “Export_Type” with values as EXCEL, CSV and PDF. Refer the snap-shot below:

     s3.JPG

Step 6: Now we need to enable/disable the respective sections as per the “Export_Type” parameter value. Use “Section Expert” to write a suppression formula

           for each section in the report. Refer the snap-shot & the formula below:

               s4.JPG

             

       For PDF      For Excel For CSV

if {?Export_Type}=”EXCEL” Then

    True

Else if {?Export_Type}”CSV” Then

    True

Else if {?Export_Type}=”PDF” Then

    False;

if {?Export_Type}=”EXCEL” Then

     False

Else if {?Export_Type}=”CSV” Then

     True

Else if {?Export_Type}=”PDF” Then

     True;

if {?Export_Type}=”EXCEL” Then

    True

Else if {?Export_Type}=”CSV” Then

    False

Else if {?Export_Type}=”PDF” Then

     True;

Step 7: The formula in the Step 6 has to be placed in the appropriate section.

Step 8: Place all the report objects/data fields in all the section by creating copies of them and format them as per the respective section.

Step 9: Refresh the report by passing the appropriate “Export_type” parameter value and see that your report will be formatted according to it.

Assigned Tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Swati Patil
      Swati Patil

      Good one Rajesh 🙂

      Keep it on.

      Author's profile photo Former Member
      Former Member

      Good one 🙂

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks

      Author's profile photo Former Member
      Former Member

      Nice document 🙂

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks

      Author's profile photo Former Member
      Former Member

      good one..

      Author's profile photo Vijesh Chandra
      Vijesh Chandra

      Thats too good.

      Rajesh, I want to ask something. I have many Crystal Report which conatains groups on fields to compute overall values. Here the thing is that, we have Report Header in 2 sections. section a contains the header which is merger of 2 header of section b. In this case when export the report as excel data, sections a header comes first and then sections b's header, hence changed all formatting of the report.

      Can you please put some light if the above solution given by you will help me out.

      Author's profile photo Former Member
      Former Member

      When creating the separate sections, I find it helpful to add a label in a small font size that specifies what the section is for (i.e. "C" for CSV, "X" for Excel or "P" for PDF). I then set this label to be suppressed.  This way, it shows up on the report designer canvas without appearing in the rendered report.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Chandra,

      Can you get me Sample screen shot.

      So that i can help you and i can clearly understand the issue.

      Place both section header fields align with same size and width in the same positions

      so that it will not merge.

      This might help you http://scn.sap.com/docs/DOC-29928

      Regards,

      Rajesh

      Author's profile photo Vijesh Chandra
      Vijesh Chandra

      Hi Rajesh,

      I am not able to attach images as "Insert Image" is disabled for me. Can you please provide your mail id so I can forward the same there?

      Vijesh

      Author's profile photo Ludek Uher
      Ludek Uher

      Hello Chandra and Rajesh

      If you take this discussion to the SAP Crystal Reports discussion forum (which you should have in the 1st place), you'll be able to upload files there.

      - Ludek

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hello Ludek,

      Sure we will start discussion in SAP Crystal Reports discussion forum .

      -Rajesh

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Chandra,

      gujaratiraj1@gmail.com you can share to it.

      Regards,

      Rajesh

      Author's profile photo Former Member
      Former Member

      Ahhh... This meets the Client Requirements 🙂

      GotcHya !!!

      -Papil

      Author's profile photo Former Member
      Former Member

      Found useful Rajesh

      Author's profile photo Satendra Kumar Srivastava
      Satendra Kumar Srivastava

      Good Document , Thanks for sharing .