Symptom
Reproducing the Issue
Resolution
sample code:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
ReportDocument m_boReportDocument;
Sections m_boSections;
ReportObjects m_boReportObjects;
SubreportObject m_boSubreportObject;
//create a new ReportDocument
m_boReportDocument = new ReportDocument();
//load the RPT file
m_boReportDocument.Load("..\\..\\HasSubreport.rpt");
//get all the sections in the report
m_boSections = m_boReportDocument.ReportDefinition.Sections;
//loop through each section of the report
foreach (Section m_boSection in m_boSections)
{
m_boReportObjects = m_boSection.ReportObjects;
//loop through each report object
foreach ( ReportObject m_boReportObject in m_boReportObjects)
{
if (m_boReportObject.Kind == ReportObjectKind.SubreportObject)
{
//get the actual subreport object
m_boSubreportObject = (SubreportObject) m_boReportObject;
//set subreport background to highlight yellow
m_boSubreportObject.Border.BackgroundColor = System.Drawing.Color.Yellow;
}
}
}
//show in reportviewer
crystalReportViewer1.ReportSource = m_boReportDocument;
Keywords
How modify subreport .NET SDK , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To