I have a Crystal Report object defined as follows:
private CrystalDecisions.CrystalReports.Engine.ReportClass rep;
I am trying to Import a SubReport into Section 1 of the report. I have tried variants of the following code: rep.ReportClientDocument.SubreportController.ImportSubreport
There seems to be conflict between:
CrystalDecisions.CrystalReports.Engine
and
CrystalDecisions.ReportAppServer
Has anybody programmatically imported a Sub-Report in Crystal using VS2010?
For anybody else who comes across this problem, the solution is:
CrystalDecisions.CrystalReports.Engine.ReportClass rep;
ReportClientDocumentWrapper doc = (ReportClientDocumentWrapper)rep.ReportClientDocument;
CrystalDecisions.ReportAppServer.ReportDefModel.Section sec = doc.ReportDefController.ReportDefinition.ReportHeaderArea.Sections[0];
doc.SubreportController.ImportSubreport("SubReport", csr.ReportFileName, sec);
rep.OpenSubreport("SubReport").SetDataSource(csr.ds.Tables[0]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With