cancel
Showing results for 
Search instead for 
Did you mean: 

How to merge two crystal reports into one in Delphi using TCrpe?

Former Member
0 Kudos

I am absolutely new to Delphi and Crystal Reports. I figured that I can export a crystal report to pdf like this:

      crpe.Clear;
    crpe.ReportName := 'BasicInfo.rpt';
    crpe.ParamFields[0].CurrentValue := '0';
    crpe.Output := toExport;
    crpe.ExportOptions.Destination := toApplication;
    crpe.ExportOptions.FileName:='C:\CoverSheet.pdf';
    crpe.ExportOptions.FileType:=AdobeAcrobatPDF;
    crpe.Export;
   

(Although this is working, please let me know if I am doing it wrong )

My main problem here is: I have two .rpts "BasicInfo.rpt" and "Details.rpt" and I need to create one pdf out of them in Delphi.

Is there any way to merge two .rpts and export it into one pdf in Delphi?

Accepted Solutions (1)

Accepted Solutions (1)

JWiseman
Active Contributor
0 Kudos

hi Milin,

you can do this in the report designer. create a new report and then Insert a new Section below the Report Header, suppress everything except for report header A & report header B.

for the Paging for report header A, ensure that New Page After is checked.

go to the Insert menu and choose Subreport and then choose existing report, and then basicinfo report and place in report header A.

repeat the above step for the 2nd report and report header B.

now you'll be able to export both reports into the same .pdf file.

-jamie

former_member183750
Active Contributor
0 Kudos

That I believe, assumes that the reports can be inserted as subreports. This also may have an impact on your database logon code and more(?)... E.g.; it will require experimentation to see that this actually produces the desired output.

- Ludek

Former Member
0 Kudos

Thank you so very much Jamie and Ludek..

Actually I wanted to do this programmatically.

Reason:

My BasicInfo.rpt always stays the same (well almost) but my Details.rpt changes depending on the client ID. Basically its like a cover page for all the clients.

Just imagine I have a cover page with To: <basic information of client> and then on 2nd page I have details about particular client. Now my 2nd page is dependent on client type. I have 60 different clients and it may grow.

I don't want to create a master report with 60 subreports and load only the one that is applicable for one particular client. Rather I wanted to create an object of type CR and then load two reports into it and export it into PDF. I understand from Ludek's reply that this is not possible, but any workaround to it?

Thanks,

Milin

former_member183750
Active Contributor
0 Kudos

Any work-around would be from the report design side - e.g.; Jamie would have better ideas than I. My only idea would be one subreport and a selection formula that will populate the subreport with data for the selected client. Obviously this assumes the subreport is consistent for all clients. But Jamie my have better ideas.

- Ludek

JWiseman
Active Contributor
0 Kudos

does the set of database columns actually differ from client to client? if not one report can be easily parameterized so that the record set reflects the different clients as Ludek mentioned above.

if the set of database columns has to be different, there are ways of parameterizing each report to each client for having dynamic columns using formulas and case statements. but that of course would have to be on the same database if you're parameterizing the actual columns. in versions from v9 you can actually parameterize the entire sql query as long as you're returning an identical column structure for the report. however you're using 8.5 so your options are much more limited.

0 Kudos

Moved to Legacy SDK forums

ido_millet
Active Contributor
0 Kudos

You can simply group the report on Customer, and design it so each customer gets a cover page and details.  No need for subreports, and no need for 2 different reports.

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

You cannot merge two reports into one PDF - not in any CR SDK. There are 3rd party utilities that will let you do this, but no APIs for this in CR.

BTW.; What version of CR are you using?

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

I am uisng Crystal Reports 8.5.