Symptom
Reproducing the Issue
Resolution
sample code:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportAppServer.ClientDoc;
//CR Declarations
ReportDocument m_boReportDocument;
ISCDReportClientDocument m_boReportClientDocument;
CrystalDecisions.ReportAppServer.ReportDefModel.Section m_boSection;
CrystalDecisions.ReportAppServer.Controllers.SubreportClientDocument m_boSubreportClientDocument;
//create a new ReportDocument
m_boReportDocument = new ReportDocument();
//load the RPT file
m_boReportDocument.Load("..\\..\\DummyReport.rpt");
//access the ReportClientDocument in the ReportDocument (EROM bridge)
m_boReportClientDocument = m_boReportDocument.ReportClientDocument;
//first determine the area to add the subreport to - in this case the report header area
m_boSection = m_boReportClientDocument.ReportDefController.ReportDefinition.ReportHeaderArea.Sections[0];
//when adding a new subreport (as opposed to importing), you need to leave the ReportURL property blank
m_boSubreportClientDocument = m_boReportClientDocument.SubreportController.ImportSubreport("testSub", "", m_boSection);
//if you try to add a sub-report to a section that is smaller than the dimensions you give the sub-report, you will get an error of
//"Invalid section height" error when you try to add sub-report links to the sub-report database tables.
//display in reportviewer
crystalReportViewer1.ReportSource = m_boReportDocument;
See Also
Keywords
How add subreport report Crystal Reports .NET inproc RAS SDK , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To